There's no Discriminator (column and value) mapped

 

From: [email protected] [mailto:[email protected]] On
Behalf Of Jugal Panchal
Sent: 24 April 2013 13:19
To: [email protected]
Subject: [nhusers] SubClass Mapping in NHibernate by using same table

 

I have one table. That is structure. There are two classes 1. Structure
and 2. Plate

Plate is inherited from Structure. The classes are

public class Structure
{
    public virtual decimal Id
    {
        get;
        set;
    }
 
    public virtual IList<Plate> ChildPlates
    {
        get;
        set;
    }
}
 
public class Plate : Structure
{
    public virtual GeometryType GeometryType
    {
        get;
        set;
    }
}
 
internal class StructureMap : ClassMap<Structure>
{
    public StructureMap()
    {
        Table("structure");
 
        Id(x => x.Id).Column("ASSET_STRUCTURE_ID");
 
        /* Set Parent_Structure_Id */
        HasMany<Plate>(x => x.ChildPlates)
            .KeyColumn("PARENT_ASSET_STRUCTURE_ID").Cascade.All();
    }
}
 
internal class PlateMap : SubclassMap<Plate>
{
    public PlateMap()
    {
        References(x =>
x.GeometryType).Column("GEOMETRY_TYPE_ID").ForeignKey("GEOMETRY_TYPE_LU_
ID");
    }
}

I create structure instance and add some child plate. when I save
structure then it gives error that "Plate is not exist". Anyone have any
idea about this. Please share your view.

-- 
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to