From: NHibernate J. <mik...@us...> - 2006-10-26 11:55:32
|
abstract class not recognized using multiple mapping files ---------------------------------------------------------- Key: NH-779 URL: http://jira.nhibernate.org/browse/NH-779 Project: NHibernate Type: Bug Versions: 1.0.2 Reporter: Hace When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. [ AbstractClass.hbm.xml ] <hibernate-mapping> <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> <id name="GeneralItemId" type="Int32" column="GeneralItemId" > <generator class="identity"/> </id> <property name="GeneralText" column="GeneralText" /> <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> <key column="GeneralItemId" /> ..concrete properties for A.. </joined-subclass> </class> </hibernate-mapping> [ ConcreteClassB.hbm.xml ] <hibernate-mapping> <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> <key column="GeneralItemId" /> ..concrete properties for B.. </joined-subclass> </hibernate-mapping> Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? [ Code ] List<AbstractClass> itemList = new List<AbstractClass>(); ISession session = OurSession.CurrentSession; ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); try { IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); itemList = new List<AbstractClass>(enumerable); } catch(Exception exception) { ... log exception.. } ...... dostuff foreach(ConcreteClassA in itemList) .... [ /code ] -- 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-10-31 09:47:29
|
[ http://jira.nhibernate.org/browse/NH-779?page=comments#action_14252 ] Hace commented on NH-779: ------------------------- One extra note: When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles AND THE MAPPINGFILE WITH THE JOINEDSUBCLASS IS IN A DIFFERENT ASSEMBLY, the connection between the abstract class and the joined subclasses is lost. When trying to read the concreteclassB from NHibernate in code, an error of 'cannot instantiate abstract class' occurs. While when reading ConcreteClassA as an abstractclass, it works perfectly. So it seems 'adding' concreteclassB as an extension for abstractclass in a separate mapping file which is in another assembly seems to be the problem. Hope this helps, > abstract class not recognized using multiple mapping files > ---------------------------------------------------------- > > Key: NH-779 > URL: http://jira.nhibernate.org/browse/NH-779 > Project: NHibernate > Type: Bug > Versions: 1.0.2 > Reporter: Hace > Attachments: JoinedSubClass.zip > > When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. > [ AbstractClass.hbm.xml ] > <hibernate-mapping> > <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> > <id name="GeneralItemId" type="Int32" column="GeneralItemId" > > <generator class="identity"/> > </id> > <property name="GeneralText" column="GeneralText" /> > > <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for A.. > </joined-subclass> > > </class> > </hibernate-mapping> > [ ConcreteClassB.hbm.xml ] > <hibernate-mapping> > <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for B.. > </joined-subclass> > </hibernate-mapping> > Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? > [ Code ] > List<AbstractClass> itemList = new List<AbstractClass>(); > ISession session = OurSession.CurrentSession; > ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); > NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); > try > { > IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); > itemList = new List<AbstractClass>(enumerable); > } > catch(Exception exception) > { > ... log exception.. > } > ...... > dostuff > foreach(ConcreteClassA in itemList) > .... > [ /code ] -- 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-11-03 10:07:25
|
[ http://jira.nhibernate.org/browse/NH-779?page=all ] Peter Smulovics updated NH-779: ------------------------------- Component: Core Description: When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. [ AbstractClass.hbm.xml ] <hibernate-mapping> <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> <id name="GeneralItemId" type="Int32" column="GeneralItemId" > <generator class="identity"/> </id> <property name="GeneralText" column="GeneralText" /> <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> <key column="GeneralItemId" /> ..concrete properties for A.. </joined-subclass> </class> </hibernate-mapping> [ ConcreteClassB.hbm.xml ] <hibernate-mapping> <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> <key column="GeneralItemId" /> ..concrete properties for B.. </joined-subclass> </hibernate-mapping> Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? [ Code ] List<AbstractClass> itemList = new List<AbstractClass>(); ISession session = OurSession.CurrentSession; ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); try { IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); itemList = new List<AbstractClass>(enumerable); } catch(Exception exception) { ... log exception.. } ...... dostuff foreach(ConcreteClassA in itemList) .... [ /code ] was: When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. [ AbstractClass.hbm.xml ] <hibernate-mapping> <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> <id name="GeneralItemId" type="Int32" column="GeneralItemId" > <generator class="identity"/> </id> <property name="GeneralText" column="GeneralText" /> <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> <key column="GeneralItemId" /> ..concrete properties for A.. </joined-subclass> </class> </hibernate-mapping> [ ConcreteClassB.hbm.xml ] <hibernate-mapping> <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> <key column="GeneralItemId" /> ..concrete properties for B.. </joined-subclass> </hibernate-mapping> Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? [ Code ] List<AbstractClass> itemList = new List<AbstractClass>(); ISession session = OurSession.CurrentSession; ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); try { IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); itemList = new List<AbstractClass>(enumerable); } catch(Exception exception) { ... log exception.. } ...... dostuff foreach(ConcreteClassA in itemList) .... [ /code ] Assigned component 'Core' > abstract class not recognized using multiple mapping files > ---------------------------------------------------------- > > Key: NH-779 > URL: http://jira.nhibernate.org/browse/NH-779 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2 > Reporter: Hace > Attachments: JoinedSubClass.zip > > When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. > [ AbstractClass.hbm.xml ] > <hibernate-mapping> > <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> > <id name="GeneralItemId" type="Int32" column="GeneralItemId" > > <generator class="identity"/> > </id> > <property name="GeneralText" column="GeneralText" /> > > <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for A.. > </joined-subclass> > > </class> > </hibernate-mapping> > [ ConcreteClassB.hbm.xml ] > <hibernate-mapping> > <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for B.. > </joined-subclass> > </hibernate-mapping> > Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? > [ Code ] > List<AbstractClass> itemList = new List<AbstractClass>(); > ISession session = OurSession.CurrentSession; > ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); > NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); > try > { > IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); > itemList = new List<AbstractClass>(enumerable); > } > catch(Exception exception) > { > ... log exception.. > } > ...... > dostuff > foreach(ConcreteClassA in itemList) > .... > [ /code ] -- 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-11-06 10:51:27
|
[ http://jira.nhibernate.org/browse/NH-779?page=all ] Sergey Koshcheyev updated NH-779: --------------------------------- Fix Version: 1.2.0.Beta2 > abstract class not recognized using multiple mapping files > ---------------------------------------------------------- > > Key: NH-779 > URL: http://jira.nhibernate.org/browse/NH-779 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2 > Reporter: Hace > Fix For: 1.2.0.Beta2 > Attachments: JoinedSubClass.zip > > When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. > [ AbstractClass.hbm.xml ] > <hibernate-mapping> > <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> > <id name="GeneralItemId" type="Int32" column="GeneralItemId" > > <generator class="identity"/> > </id> > <property name="GeneralText" column="GeneralText" /> > > <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for A.. > </joined-subclass> > > </class> > </hibernate-mapping> > [ ConcreteClassB.hbm.xml ] > <hibernate-mapping> > <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for B.. > </joined-subclass> > </hibernate-mapping> > Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? > [ Code ] > List<AbstractClass> itemList = new List<AbstractClass>(); > ISession session = OurSession.CurrentSession; > ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); > NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); > try > { > IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); > itemList = new List<AbstractClass>(enumerable); > } > catch(Exception exception) > { > ... log exception.. > } > ...... > dostuff > foreach(ConcreteClassA in itemList) > .... > [ /code ] -- 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-11-06 14:41:29
|
[ http://jira.nhibernate.org/browse/NH-779?page=all ] Sergey Koshcheyev closed NH-779: -------------------------------- Fix Version: (was: 1.2.0.Beta2) Resolution: Fixed Seems to work for me using the SVN version, so I'm assuming it was fixed some time ago. > abstract class not recognized using multiple mapping files > ---------------------------------------------------------- > > Key: NH-779 > URL: http://jira.nhibernate.org/browse/NH-779 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2 > Reporter: Hace > Attachments: JoinedSubClass.zip > > When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. > [ AbstractClass.hbm.xml ] > <hibernate-mapping> > <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> > <id name="GeneralItemId" type="Int32" column="GeneralItemId" > > <generator class="identity"/> > </id> > <property name="GeneralText" column="GeneralText" /> > > <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for A.. > </joined-subclass> > > </class> > </hibernate-mapping> > [ ConcreteClassB.hbm.xml ] > <hibernate-mapping> > <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for B.. > </joined-subclass> > </hibernate-mapping> > Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? > [ Code ] > List<AbstractClass> itemList = new List<AbstractClass>(); > ISession session = OurSession.CurrentSession; > ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); > NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); > try > { > IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); > itemList = new List<AbstractClass>(enumerable); > } > catch(Exception exception) > { > ... log exception.. > } > ...... > dostuff > foreach(ConcreteClassA in itemList) > .... > [ /code ] -- 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-11-06 15:33:32
|
[ http://jira.nhibernate.org/browse/NH-779?page=comments#action_14305 ] Hace commented on NH-779: ------------------------- Hi, I just downloaded version 1.0.3 released 2 nov 2006 and indeed: FIXED! Thanks. > abstract class not recognized using multiple mapping files > ---------------------------------------------------------- > > Key: NH-779 > URL: http://jira.nhibernate.org/browse/NH-779 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2 > Reporter: Hace > Attachments: JoinedSubClass.zip > > When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. > [ AbstractClass.hbm.xml ] > <hibernate-mapping> > <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> > <id name="GeneralItemId" type="Int32" column="GeneralItemId" > > <generator class="identity"/> > </id> > <property name="GeneralText" column="GeneralText" /> > > <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for A.. > </joined-subclass> > > </class> > </hibernate-mapping> > [ ConcreteClassB.hbm.xml ] > <hibernate-mapping> > <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for B.. > </joined-subclass> > </hibernate-mapping> > Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? > [ Code ] > List<AbstractClass> itemList = new List<AbstractClass>(); > ISession session = OurSession.CurrentSession; > ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); > NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); > try > { > IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); > itemList = new List<AbstractClass>(enumerable); > } > catch(Exception exception) > { > ... log exception.. > } > ...... > dostuff > foreach(ConcreteClassA in itemList) > .... > [ /code ] -- 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-11-21 08:57:42
|
[ http://jira.nhibernate.org/browse/NH-779?page=all ] Sergey Koshcheyev updated NH-779: --------------------------------- Comment: was deleted > abstract class not recognized using multiple mapping files > ---------------------------------------------------------- > > Key: NH-779 > URL: http://jira.nhibernate.org/browse/NH-779 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.0.2 > Reporter: Hace > Attachments: JoinedSubClass.zip > > When an abstract class and (one or more) joined-subclasses are not in one mapping file, but joined-subclasses are in separate mappingfiles, the connection between the abstract class and the joined subclasses is lost. An error of 'cannot instantiate abstract class' occurs. > [ AbstractClass.hbm.xml ] > <hibernate-mapping> > <class name="Namespace.Common.AbstractClass, Namespace.Common" table="GeneralItem"> > <id name="GeneralItemId" type="Int32" column="GeneralItemId" > > <generator class="identity"/> > </id> > <property name="GeneralText" column="GeneralText" /> > > <joined-subclass name="Namespace.Common.A.ConcreteClassA, Namespace.Common.A" table="ItemsA" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for A.. > </joined-subclass> > > </class> > </hibernate-mapping> > [ ConcreteClassB.hbm.xml ] > <hibernate-mapping> > <joined-subclass name="Namespace.Common.B.ConcreteClassB, Namespace.Common.B" table="ItemsB" extends="Namespace.Common.AbstractClass, Namespace.Common"> > <key column="GeneralItemId" /> > ..concrete properties for B.. > </joined-subclass> > </hibernate-mapping> > Items for ConcreteClassB will not be loaded correctly, only because the joined-subclass is not in the SAME mappingfile as ConcreteClassA ? > [ Code ] > List<AbstractClass> itemList = new List<AbstractClass>(); > ISession session = OurSession.CurrentSession; > ICriteria NHibernateCriteria = session.CreateCriteria(typeof(AbstractClass)); > NHibernateCriteria.Add(Expression.In("GeneralItemId", generalItemIds.ToArray())); > try > { > IEnumerable<AbstractClass> enumerable = (AbstractClass[])ArrayList.Adapter(NHibernateCriteria.List()).ToArray(typeof(AbstractClass)); > itemList = new List<AbstractClass>(enumerable); > } > catch(Exception exception) > { > ... log exception.. > } > ...... > dostuff > foreach(ConcreteClassA in itemList) > .... > [ /code ] -- 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 |