From: NHibernate J. <mik...@us...> - 2006-11-13 19:22:43
|
[ http://jira.nhibernate.org/browse/NH-662?page=all ] Sergey Koshcheyev updated NH-662: --------------------------------- Fix Version: LATER Version: 1.2.0.Beta2 > Class Hierarchies > ----------------- > > Key: NH-662 > URL: http://jira.nhibernate.org/browse/NH-662 > Project: NHibernate > Type: New Feature > Components: Core > Versions: 1.2.0.Beta2 > Reporter: Anton Gogolev > Priority: Minor > Fix For: LATER > > NH can only persist/load classes explicitly mapped to database tables in HBM files. On the one hand, this is quite logical. But on the other it limits further use of mapped classes. For instance, it is impossible to inherit from them and save the ancestor since its type is not mentioned anywhere in the mapping files. Here's an example: > // Base is mapped to, say, Base table in Base.hbm.xml > class Base > { > public int A > { get ...; set ... } > protected virtual Foo() > { > // Some logic. > } > } > // Derived has no mapping file > class Derived : Base > { > protected override Foo() > { > // Some other logic > } > } > static void Main() > { > ISession session = sessionFactory.OpenSession(); > Base base = new Base(); > base.A = 12; > session.Save(base); // This succeeds > base = session.Load(typeof(Base), 2) as Base; // This succeeds as well > base = new Derived(); // Note "Derived" here > base.A = 13; > session.Save(base); // And this fails > // We won't even get here, but if we did, > // this would have failed too > base = session.Load(typeof(Derived), 3) as Derived; > } > As you can see, the logic behind this is quite OOP-ish :) You inherit from some class to extend its functionality and state (in other words, functions and member variables). However, this is not possible with NHibernate, since it requires every derived class to be mapped somehow. > How I see it done (conceptually) is as follows. > Upon persisting an entity NH should traverse a list of base classes of the entity being persisted, until it finds a type which is mapped to a database table. This type is used to persist an entity. > When loading an entity from the database, NH can freely create an instance of derived class, since it is given its type (typeof(Derived) in the example above). Then again it traveses a list of base classes, and loads derived object as an object of base class. Of course some properties remain uninitialized, but that's not a problem, I think. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-12-04 06:15:37
|
[ http://jira.nhibernate.org/browse/NH-662?page=all ] Sergey Koshcheyev updated NH-662: --------------------------------- Comment: was deleted > Class Hierarchies > ----------------- > > Key: NH-662 > URL: http://jira.nhibernate.org/browse/NH-662 > Project: NHibernate > Type: New Feature > Components: Core > Versions: 1.2.0.Beta2 > Reporter: Anton Gogolev > Priority: Minor > Fix For: LATER > > NH can only persist/load classes explicitly mapped to database tables in HBM files. On the one hand, this is quite logical. But on the other it limits further use of mapped classes. For instance, it is impossible to inherit from them and save the ancestor since its type is not mentioned anywhere in the mapping files. Here's an example: > // Base is mapped to, say, Base table in Base.hbm.xml > class Base > { > public int A > { get ...; set ... } > protected virtual Foo() > { > // Some logic. > } > } > // Derived has no mapping file > class Derived : Base > { > protected override Foo() > { > // Some other logic > } > } > static void Main() > { > ISession session = sessionFactory.OpenSession(); > Base base = new Base(); > base.A = 12; > session.Save(base); // This succeeds > base = session.Load(typeof(Base), 2) as Base; // This succeeds as well > base = new Derived(); // Note "Derived" here > base.A = 13; > session.Save(base); // And this fails > // We won't even get here, but if we did, > // this would have failed too > base = session.Load(typeof(Derived), 3) as Derived; > } > As you can see, the logic behind this is quite OOP-ish :) You inherit from some class to extend its functionality and state (in other words, functions and member variables). However, this is not possible with NHibernate, since it requires every derived class to be mapped somehow. > How I see it done (conceptually) is as follows. > Upon persisting an entity NH should traverse a list of base classes of the entity being persisted, until it finds a type which is mapped to a database table. This type is used to persist an entity. > When loading an entity from the database, NH can freely create an instance of derived class, since it is given its type (typeof(Derived) in the example above). Then again it traveses a list of base classes, and loads derived object as an object of base class. Of course some properties remain uninitialized, but that's not a problem, I think. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2007-01-15 12:49:47
|
[ http://jira.nhibernate.org/browse/NH-662?page=all ] Sergey Koshcheyev updated NH-662: --------------------------------- Comment: was deleted > Class Hierarchies > ----------------- > > Key: NH-662 > URL: http://jira.nhibernate.org/browse/NH-662 > Project: NHibernate > Type: New Feature > Components: Core > Versions: 1.2.0.Beta2 > Reporter: Anton Gogolev > Priority: Minor > Fix For: LATER > > NH can only persist/load classes explicitly mapped to database tables in HBM files. On the one hand, this is quite logical. But on the other it limits further use of mapped classes. For instance, it is impossible to inherit from them and save the ancestor since its type is not mentioned anywhere in the mapping files. Here's an example: > // Base is mapped to, say, Base table in Base.hbm.xml > class Base > { > public int A > { get ...; set ... } > protected virtual Foo() > { > // Some logic. > } > } > // Derived has no mapping file > class Derived : Base > { > protected override Foo() > { > // Some other logic > } > } > static void Main() > { > ISession session = sessionFactory.OpenSession(); > Base base = new Base(); > base.A = 12; > session.Save(base); // This succeeds > base = session.Load(typeof(Base), 2) as Base; // This succeeds as well > base = new Derived(); // Note "Derived" here > base.A = 13; > session.Save(base); // And this fails > // We won't even get here, but if we did, > // this would have failed too > base = session.Load(typeof(Derived), 3) as Derived; > } > As you can see, the logic behind this is quite OOP-ish :) You inherit from some class to extend its functionality and state (in other words, functions and member variables). However, this is not possible with NHibernate, since it requires every derived class to be mapped somehow. > How I see it done (conceptually) is as follows. > Upon persisting an entity NH should traverse a list of base classes of the entity being persisted, until it finds a type which is mapped to a database table. This type is used to persist an entity. > When loading an entity from the database, NH can freely create an instance of derived class, since it is given its type (typeof(Derived) in the example above). Then again it traveses a list of base classes, and loads derived object as an object of base class. Of course some properties remain uninitialized, but that's not a problem, I think. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2007-02-02 19:07:28
|
[ http://jira.nhibernate.org/browse/NH-662?page=all ] Sergey Koshcheyev updated NH-662: --------------------------------- Comment: was deleted > Class Hierarchies > ----------------- > > Key: NH-662 > URL: http://jira.nhibernate.org/browse/NH-662 > Project: NHibernate > Type: New Feature > Components: Core > Versions: 1.2.0.Beta2 > Reporter: Anton Gogolev > Priority: Minor > Fix For: LATER > > NH can only persist/load classes explicitly mapped to database tables in HBM files. On the one hand, this is quite logical. But on the other it limits further use of mapped classes. For instance, it is impossible to inherit from them and save the ancestor since its type is not mentioned anywhere in the mapping files. Here's an example: > // Base is mapped to, say, Base table in Base.hbm.xml > class Base > { > public int A > { get ...; set ... } > protected virtual Foo() > { > // Some logic. > } > } > // Derived has no mapping file > class Derived : Base > { > protected override Foo() > { > // Some other logic > } > } > static void Main() > { > ISession session = sessionFactory.OpenSession(); > Base base = new Base(); > base.A = 12; > session.Save(base); // This succeeds > base = session.Load(typeof(Base), 2) as Base; // This succeeds as well > base = new Derived(); // Note "Derived" here > base.A = 13; > session.Save(base); // And this fails > // We won't even get here, but if we did, > // this would have failed too > base = session.Load(typeof(Derived), 3) as Derived; > } > As you can see, the logic behind this is quite OOP-ish :) You inherit from some class to extend its functionality and state (in other words, functions and member variables). However, this is not possible with NHibernate, since it requires every derived class to be mapped somehow. > How I see it done (conceptually) is as follows. > Upon persisting an entity NH should traverse a list of base classes of the entity being persisted, until it finds a type which is mapped to a database table. This type is used to persist an entity. > When loading an entity from the database, NH can freely create an instance of derived class, since it is given its type (typeof(Derived) in the example above). Then again it traveses a list of base classes, and loads derived object as an object of base class. Of course some properties remain uninitialized, but that's not a problem, I think. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2007-02-06 17:20:44
|
[ http://jira.nhibernate.org/browse/NH-662?page=all ] Sergey Koshcheyev updated NH-662: --------------------------------- Comment: was deleted > Class Hierarchies > ----------------- > > Key: NH-662 > URL: http://jira.nhibernate.org/browse/NH-662 > Project: NHibernate > Type: New Feature > Components: Core > Versions: 1.2.0.Beta2 > Reporter: Anton Gogolev > Priority: Minor > Fix For: LATER > > NH can only persist/load classes explicitly mapped to database tables in HBM files. On the one hand, this is quite logical. But on the other it limits further use of mapped classes. For instance, it is impossible to inherit from them and save the ancestor since its type is not mentioned anywhere in the mapping files. Here's an example: > // Base is mapped to, say, Base table in Base.hbm.xml > class Base > { > public int A > { get ...; set ... } > protected virtual Foo() > { > // Some logic. > } > } > // Derived has no mapping file > class Derived : Base > { > protected override Foo() > { > // Some other logic > } > } > static void Main() > { > ISession session = sessionFactory.OpenSession(); > Base base = new Base(); > base.A = 12; > session.Save(base); // This succeeds > base = session.Load(typeof(Base), 2) as Base; // This succeeds as well > base = new Derived(); // Note "Derived" here > base.A = 13; > session.Save(base); // And this fails > // We won't even get here, but if we did, > // this would have failed too > base = session.Load(typeof(Derived), 3) as Derived; > } > As you can see, the logic behind this is quite OOP-ish :) You inherit from some class to extend its functionality and state (in other words, functions and member variables). However, this is not possible with NHibernate, since it requires every derived class to be mapped somehow. > How I see it done (conceptually) is as follows. > Upon persisting an entity NH should traverse a list of base classes of the entity being persisted, until it finds a type which is mapped to a database table. This type is used to persist an entity. > When loading an entity from the database, NH can freely create an instance of derived class, since it is given its type (typeof(Derived) in the example above). Then again it traveses a list of base classes, and loads derived object as an object of base class. Of course some properties remain uninitialized, but that's not a problem, I think. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <nh...@gm...> - 2008-09-18 22:08:12
|
[ http://jira.nhibernate.org/browse/NH-662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-662: --------------------------- Comment: was deleted > Class Hierarchies > ----------------- > > Key: NH-662 > URL: http://jira.nhibernate.org/browse/NH-662 > Project: NHibernate > Issue Type: New Feature > Components: Core > Affects Versions: 1.2.0.Beta2 > Reporter: Anton Gogolev > Priority: Minor > Fix For: 2.1.0.Alpha1 > > > NH can only persist/load classes explicitly mapped to database tables in HBM files. On the one hand, this is quite logical. But on the other it limits further use of mapped classes. For instance, it is impossible to inherit from them and save the ancestor since its type is not mentioned anywhere in the mapping files. Here's an example: > // Base is mapped to, say, Base table in Base.hbm.xml > class Base > { > public int A > { get ...; set ... } > protected virtual Foo() > { > // Some logic. > } > } > // Derived has no mapping file > class Derived : Base > { > protected override Foo() > { > // Some other logic > } > } > static void Main() > { > ISession session = sessionFactory.OpenSession(); > Base base = new Base(); > base.A = 12; > session.Save(base); // This succeeds > base = session.Load(typeof(Base), 2) as Base; // This succeeds as well > base = new Derived(); // Note "Derived" here > base.A = 13; > session.Save(base); // And this fails > // We won't even get here, but if we did, > // this would have failed too > base = session.Load(typeof(Derived), 3) as Derived; > } > As you can see, the logic behind this is quite OOP-ish :) You inherit from some class to extend its functionality and state (in other words, functions and member variables). However, this is not possible with NHibernate, since it requires every derived class to be mapped somehow. > How I see it done (conceptually) is as follows. > Upon persisting an entity NH should traverse a list of base classes of the entity being persisted, until it finds a type which is mapped to a database table. This type is used to persist an entity. > When loading an entity from the database, NH can freely create an instance of derived class, since it is given its type (typeof(Derived) in the example above). Then again it traveses a list of base classes, and loads derived object as an object of base class. Of course some properties remain uninitialized, but that's not a problem, I think. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <nh...@gm...> - 2008-09-30 12:37:10
|
[ http://jira.nhibernate.org/browse/NH-662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-662: --------------------------- Fix Version/s: (was: 2.1.0.Alpha1) > Class Hierarchies > ----------------- > > Key: NH-662 > URL: http://jira.nhibernate.org/browse/NH-662 > Project: NHibernate > Issue Type: New Feature > Components: Core > Affects Versions: 1.2.0.Beta2 > Reporter: Anton Gogolev > Priority: Minor > > NH can only persist/load classes explicitly mapped to database tables in HBM files. On the one hand, this is quite logical. But on the other it limits further use of mapped classes. For instance, it is impossible to inherit from them and save the ancestor since its type is not mentioned anywhere in the mapping files. Here's an example: > // Base is mapped to, say, Base table in Base.hbm.xml > class Base > { > public int A > { get ...; set ... } > protected virtual Foo() > { > // Some logic. > } > } > // Derived has no mapping file > class Derived : Base > { > protected override Foo() > { > // Some other logic > } > } > static void Main() > { > ISession session = sessionFactory.OpenSession(); > Base base = new Base(); > base.A = 12; > session.Save(base); // This succeeds > base = session.Load(typeof(Base), 2) as Base; // This succeeds as well > base = new Derived(); // Note "Derived" here > base.A = 13; > session.Save(base); // And this fails > // We won't even get here, but if we did, > // this would have failed too > base = session.Load(typeof(Derived), 3) as Derived; > } > As you can see, the logic behind this is quite OOP-ish :) You inherit from some class to extend its functionality and state (in other words, functions and member variables). However, this is not possible with NHibernate, since it requires every derived class to be mapped somehow. > How I see it done (conceptually) is as follows. > Upon persisting an entity NH should traverse a list of base classes of the entity being persisted, until it finds a type which is mapped to a database table. This type is used to persist an entity. > When loading an entity from the database, NH can freely create an instance of derived class, since it is given its type (typeof(Derived) in the example above). Then again it traveses a list of base classes, and loads derived object as an object of base class. Of course some properties remain uninitialized, but that's not a problem, I think. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |