public class BaseObject { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual Container Container { get; set; } }
public class Object1 : BaseObject { public virtual string Prop1 { get; set; } }
public class Object2 : BaseObject { public virtual string Prop2 { get; set; } }
public class Container { public Container() { Objects = new List<BaseObject>(); } public virtual List<BaseObject> Objects { get; set; } }
Container container = new Container(); container.Objects.Add(new Object1()); container.Objects.Add(new Object2());
Is that possible to save such object model with hibernate? I tried all three: subclass, joined-subclass, union-subclass to save Object1 and Object2. Nothing works.
Can anybody point me where to read how to save List of polymorphic objects?
Thank You.
Last edited by RomanGuzi on Wed Jul 22, 2009 2:47 am, edited 1 time in total.
|