[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-3382) net.sf.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass:
Gail Badner (JIRA)
noreply at atlassian.com
Fri Jul 11 17:41:12 EDT 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gail Badner closed HHH-3382.
----------------------------
Assignee: Gail Badner
Resolution: Rejected
Please use the user forum (http://forum.hibernate.org/) for help.
> net.sf.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass:
> -------------------------------------------------------------------------------------------
>
> Key: HHH-3382
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3382
> Project: Hibernate3
> Issue Type: Bug
> Environment: hibernate 2.1.7 , mysql
> Reporter: cristian vargas
> Assignee: Gail Badner
> Attachments: diagram.JPG
>
>
> i got this error in my project , please can anybody help me? i have an inheritance mapping , you can see the class diagrama in the attachment. i want to map the sell class, there are two references , one to the client class and the other one to the employment class.
> this is the mapping that i built
> <!DOCTYPE hibernate-mapping PUBLIC
> "-//Hibernate/Hibernate Mapping DTD//EN"
> "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
> <hibernate-mapping>
> <class name="Inventory.Sell" table="Sell">
> <id name="Id_Sell" type="integer">
> <column name="Id_Sell" />
> <generator class="identity" />
> </id>
> <property name="FechaPedido" type="date">
> <column name="FechaPedido" />
> </property>
> <many-to-one name="Id_Cliente" class="Inventory.Client" >
> <column name="Id_Cliente" not-null="false" />
> </many-to-one>
>
> <many-to-one name="Id_Employment" class="Inventory.Employment" >
> <column name="Id_Employment" not-null="false" />
> </many-to-one>
> </class>
> </hibernate-mapping>
> and this is the mapping for the inheritance
> <!DOCTYPE hibernate-mapping PUBLIC
> "-//Hibernate/Hibernate Mapping DTD//EN"
> "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
> <hibernate-mapping>
> <class name="Inventory.Person" table="person" >
> <id name="Id_Persona" type="integer">
> <column name="Id_Persona" />
> <generator class="identity" />
> </id>
> <property name="CI" type="string">
> <column name="CI" length="20" />
> </property>
> <property name="nombre" type="string">
> <column name="Nombre" length="100" />
> </property>
> <property name="trabajoDir" type="string">
> <column name="DireccionTrabajo" length="100" />
> </property>
> <property name="DireccionDomicilio" type="string">
> <column name="DireccionDomicilio" length="100" />
> </property>
> <property name="Celular" type="string">
> <column name="Celular" length="100" />
> </property>
>
>
>
> <set name="emailAddresses" table="email">
> <key column="Id_Email"/>
> <element type="string" column="Email"/>
> </set>
>
> <set name="telefono" table="telefono">
> <key column="Id_Telefono"/>
> <element type="string" column="Telefono"/>
> </set>
>
> <set name="fax" table="fax">
> <key column="Id_Fax"/>
> <element type="string" column="Fax"/>
> </set>
>
>
> <joined-subclass name="Inventory.Employment" table="employment">
> <key column="Id_Empleado"/>
>
> <property name="Sueldo" type="string">
> <column name="Sueldo" length="100" />
> </property>
>
> <property name="Moneda" type="string">
> <column name="Moneda" length="100" />
> </property>
> <property name="FechaContrato" type="date">
> <column name="FechaContrato" />
> </property>
>
> </joined-subclass>
>
> <joined-subclass name="Inventory.Client" table="client">
> <key column="Id_Cliente"/>
>
>
> </joined-subclass>
>
> </class>
> </hibernate-mapping>
> this is the error that i get:
> net.sf.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass: ......................................
> at net.sf.hibernate.loader.Loader.instanceAlreadyLoaded(Loader.java:531) at net.sf.hibernate.loader.Loader.getRow(Loader.java:498) at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:213) at net.sf.hibernate.loader.Loader.doQuery(Loader.java:281) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:990) at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:965) at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93) at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:288) at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3303) at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:336) at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3156) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138) at net.sf.hibernate.loader.Loader.doList(Loader.java:1033) at net.sf.hibernate.loader.Loader.list(Loader.java:1024) at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1530) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1522) at hibernate.conexion.consulta(conexion.java:177) at _Control__Acceso._jspService(_Control__Acceso.java:80) [/Control_Acceso.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.1.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list