Joined: Thu Jun 16, 2005 5:02 pm Posts: 1 Location: Mexico City
|
I'm having problems trying to save a parent with 2 children (both have composite-id) one of the fields of the child's ID is the parent ID. I'm testing my clases with JUNIT
[b]Hibernate version:[/b]
Hibernate 2.1.2
[b]Mapping documents:[/b]
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable" table="TBL_SIF_CAT_POLIZAS_CONTABLES">
<id name="id">
<column name="ID_MODELO_POLIZA" sql-type="Long" not-null="true"/>
<generator class="increment" />
</id>
<version name="fechaModificacion" column="FECHA_MOD" type="timestamp" unsaved-value="null" />
<property name="clave" column="CLAVE"/>
<property name="description" column="DESCRIPCION"/>
<property name="usuario" column="USUARIO"/>
<property name="fechaCreacion" column="FECHA_CRE"/>
<property name="comentarios" column="COMENTARIOS"/>
<property name="estatus" column="ESTATUS"/>
<property name="tipoPoliza" column="TIPO" />
<set
name="registros"
inverse="true"
lazy="true"
cascade="all-delete-orphan">
<key column="ID_MODELO_POLIZA" />
<one-to-many class="mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContable" />
</set>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContable" table="TBL_SIF_CAT_REGISTROS_CONT">
<composite-id name="compositeID" class="mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID">
<key-many-to-one name="idPoliza" column="ID_MODELO_POLIZA" class="mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable" />
<key-property name="numero" column="NUMERO"/>
</composite-id>
<property name="tipoMovimento" column="TIPO_MOVIMIENTO" />
<property name="tipoCentroCostos" column="TIPO_CENTRO_COSTOS"/>
<property name="descripcion" column="DESCRIPCION"/>
<property name="proyecto" column="PROYECTO"/>
<property name="producto" column="PRODUCTO" />
<property name="temporal" column="TEMPORAL"/>
<property name="tipoImporte" column="TIPO_IMPORTE"/>
<many-to-one
name="centroCostos"
column="ID_CENTRO_COSTOS"
class="mx.com.prosa.silfac.facturacion.dmn.catalogos.CentroCostos" />
<many-to-one
name="empresa"
column="ID_EMPRESA"
class="mx.com.prosa.silfac.facturacion.dmn.catalogos.Empresa">
</many-to-one>
<many-to-one
name="tipoCuentaContable"
column="ID_TIPO_CUENTA_CONTABLE"
class="mx.com.prosa.silfac.facturacion.dmn.catalogos.TipoCuentaContable">
</many-to-one>
</class>
</hibernate-mapping>
[b]Code between sessionFactory.openSession() and session.close():[/b]
DEBUG [main] (SessionFactoryImpl.java:196) - instantiated session factory
25000 [main] DEBUG net.sf.hibernate.impl.SessionFactoryImpl - instantiated session factory
INFO [main] (UpdateTimestampsCache.java:35) - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
25031 [main] INFO net.sf.hibernate.cache.UpdateTimestampsCache - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
INFO [main] (QueryCache.java:39) - starting query cache at region: net.sf.hibernate.cache.QueryCache
25047 [main] INFO net.sf.hibernate.cache.QueryCache - starting query cache at region: net.sf.hibernate.cache.QueryCache
PersistenceConnector - static configuration finished.
INFO [main] (LoggerSistema.java:48) - PersistenceConnector - Initial configuration finished.
25047 [main] INFO mx.com.prosa.silfac.comun.utilerias.LoggerSistema - PersistenceConnector - Initial configuration finished.
DEBUG [main] (SessionImpl.java:531) - opened session
25500 [main] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
INFO [main] (LoggerSistema.java:48) - BasicDAOTest - ===================================================================================
25500 [main] INFO mx.com.prosa.silfac.comun.utilerias.LoggerSistema - BasicDAOTest - ===================================================================================
INFO [main] (LoggerSistema.java:48) - BasicDAOTest - ============================== INICIO DE LAS PRUEBAS ==============================
25515 [main] INFO mx.com.prosa.silfac.comun.utilerias.LoggerSistema - BasicDAOTest - ============================== INICIO DE LAS PRUEBAS ==============================
INFO [main] (LoggerSistema.java:48) - BasicDAOTest - ===================================================================================
25515 [main] INFO mx.com.prosa.silfac.comun.utilerias.LoggerSistema - BasicDAOTest - ===================================================================================
DEBUG [main] (JDBCTransaction.java:37) - begin
25531 [main] DEBUG net.sf.hibernate.transaction.JDBCTransaction - begin
DEBUG [main] (DriverManagerConnectionProvider.java:78) - total checked-out connections: 0
25531 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0
DEBUG [main] (DriverManagerConnectionProvider.java:84) - using pooled JDBC connection, pool size: 0
25531 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
DEBUG [main] (JDBCTransaction.java:41) - current autocommit status:false
25531 [main] DEBUG net.sf.hibernate.transaction.JDBCTransaction - current autocommit status:false
DEBUG [main] (LoggerSistema.java:36) - PersistenceConnector - método getInstance
25656 [main] DEBUG mx.com.prosa.silfac.comun.utilerias.LoggerSistema - PersistenceConnector - método getInstance
INFO [main] (LoggerSistema.java:48) - PersistenceConnector - método getSession
25656 [main] INFO mx.com.prosa.silfac.comun.utilerias.LoggerSistema - PersistenceConnector - método getSession
DEBUG [main] (IncrementGenerator.java:62) - fetching initial value: select max(ID_MODELO_POLIZA) from TBL_SIF_CAT_POLIZAS_CONTABLES
25672 [main] DEBUG net.sf.hibernate.id.IncrementGenerator - fetching initial value: select max(ID_MODELO_POLIZA) from TBL_SIF_CAT_POLIZAS_CONTABLES
DEBUG [main] (IncrementGenerator.java:76) - first free id: 2
25781 [main] DEBUG net.sf.hibernate.id.IncrementGenerator - first free id: 2
DEBUG [main] (SessionImpl.java:760) - generated identifier: 2
25781 [main] DEBUG net.sf.hibernate.impl.SessionImpl - generated identifier: 2
DEBUG [main] (SessionImpl.java:807) - saving [mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable#2]
25797 [main] DEBUG net.sf.hibernate.impl.SessionImpl - saving [mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable#2]
DEBUG [main] (Cascades.java:497) - processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
25797 [main] DEBUG net.sf.hibernate.engine.Cascades - processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
DEBUG [main] (Cascades.java:506) - done processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
25797 [main] DEBUG net.sf.hibernate.engine.Cascades - done processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
DEBUG [main] (Versioning.java:56) - using initial version: Thu Jun 16 16:53:49 CDT 2005
25812 [main] DEBUG net.sf.hibernate.engine.Versioning - using initial version: Thu Jun 16 16:53:49 CDT 2005
DEBUG [main] (Cascades.java:497) - processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
25812 [main] DEBUG net.sf.hibernate.engine.Cascades - processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
DEBUG [main] (Cascades.java:524) - cascading to collection: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.registros
25828 [main] DEBUG net.sf.hibernate.engine.Cascades - cascading to collection: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.registros
DEBUG [main] (Cascades.java:113) - cascading to saveOrUpdate()
25828 [main] DEBUG net.sf.hibernate.engine.Cascades - cascading to saveOrUpdate()
DEBUG [main] (Cascades.java:331) - id unsaved-value strategy NONE
25828 [main] DEBUG net.sf.hibernate.engine.Cascades - id unsaved-value strategy NONE
ility config property
DEBUG [main] (SessionImpl.java:1363) - saveOrUpdate() previously saved instance with id: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID@5b34
25922 [main] DEBUG net.sf.hibernate.impl.SessionImpl - saveOrUpdate() previously saved instance with id: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID@5b34
DEBUG [main] (SessionImpl.java:1411) - updating [mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContable#mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID@5b34]
25922 [main] DEBUG net.sf.hibernate.impl.SessionImpl - updating [mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContable#mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID@5b34]
DEBUG [main] (Cascades.java:113) - cascading to saveOrUpdate()
25937 [main] DEBUG net.sf.hibernate.engine.Cascades - cascading to saveOrUpdate()
DEBUG [main] (Cascades.java:331) - id unsaved-value strategy NONE
25937 [main] DEBUG net.sf.hibernate.engine.Cascades - id unsaved-value strategy NONE
DEBUG [main] (SessionImpl.java:1363) - saveOrUpdate() previously saved instance with id: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID@5b35
25937 [main] DEBUG net.sf.hibernate.impl.SessionImpl - saveOrUpdate() previously saved instance with id: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID@5b35
DEBUG [main] (SessionImpl.java:1411) - updating [mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContable#mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID@5b35]
25937 [main] DEBUG net.sf.hibernate.impl.SessionImpl - updating [mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContable#mx.com.prosa.silfac.facturacion.dmn.registro.ModeloRegistroContableCompositeID@5b35]
DEBUG [main] (Cascades.java:506) - done processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
25937 [main] DEBUG net.sf.hibernate.engine.Cascades - done processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
DEBUG [main] (SessionImpl.java:2210) - flushing session
25937 [main] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
DEBUG [main] (Cascades.java:497) - processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
25953 [main] DEBUG net.sf.hibernate.engine.Cascades - processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
DEBUG [main] (Cascades.java:524) - cascading to collection: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.registros
25953 [main] DEBUG net.sf.hibernate.engine.Cascades - cascading to collection: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.registros
DEBUG [main] (Cascades.java:113) - cascading to saveOrUpdate()
25953 [main] DEBUG net.sf.hibernate.engine.Cascades - cascading to saveOrUpdate()
DEBUG [main] (SessionImpl.java:1343) - saveOrUpdate() persistent instance
25953 [main] DEBUG net.sf.hibernate.impl.SessionImpl - saveOrUpdate() persistent instance
DEBUG [main] (Cascades.java:113) - cascading to saveOrUpdate()
25969 [main] DEBUG net.sf.hibernate.engine.Cascades - cascading to saveOrUpdate()
DEBUG [main] (SessionImpl.java:1343) - saveOrUpdate() persistent instance
25969 [main] DEBUG net.sf.hibernate.impl.SessionImpl - saveOrUpdate() persistent instance
DEBUG [main] (Cascades.java:506) - done processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
25969 [main] DEBUG net.sf.hibernate.engine.Cascades - done processing cascades for: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable
DEBUG [main] (SessionImpl.java:2403) - Flushing entities and processing referenced collections
25969 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
DEBUG [main] (WrapVisitor.java:76) - Wrapped collection in role: mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.registros
[b]Full stack trace of any exception that occurs:[/b]
ERROR [main] (LoggerSistema.java:42) - mx.com.prosa.silfac.facturacion.eai.registro.ModeloPolizaContableDAO - Error al intentar realizar la operación: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.setRegistros
net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.setRegistros
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:213)
at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2552)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2422)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2224)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2203)
at mx.com.prosa.silfac.facturacion.eai.registro.ModeloPolizaContableDAO.crear(ModeloPolizaContableDAO.java:144)
at mx.com.prosa.silfac.facturacion.eai.registro.test.ModeloPolizaContableDAOTest.testCrear(ModeloPolizaContableDAOTest.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(Unknown Source)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(Unknown Source)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(Unknown Source)
at com.intellij.rt.execution.junit2.JUnitStarter.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Caused by: net.sf.cglib.beans.BulkBeanException
at mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable$$BulkBeanByCGLIB$$29496c5a.setPropertyValues(<generated>)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:208)
... 29 more
Caused by: java.lang.ClassCastException
... 31 more
26015 [main] ERROR mx.com.prosa.silfac.comun.utilerias.LoggerSistema - mx.com.prosa.silfac.facturacion.eai.registro.ModeloPolizaContableDAO - Error al intentar realizar la operación: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.setRegistros
net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable.setRegistros
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:213)
at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2552)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2422)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2224)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2203)
at mx.com.prosa.silfac.facturacion.eai.registro.ModeloPolizaContableDAO.crear(ModeloPolizaContableDAO.java:144)
at mx.com.prosa.silfac.facturacion.eai.registro.test.ModeloPolizaContableDAOTest.testCrear(ModeloPolizaContableDAOTest.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(Unknown Source)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(Unknown Source)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(Unknown Source)
at com.intellij.rt.execution.junit2.JUnitStarter.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Caused by: net.sf.cglib.beans.BulkBeanException
at mx.com.prosa.silfac.facturacion.dmn.registro.ModeloPolizaContable$$BulkBeanByCGLIB$$29496c5a.setPropertyValues(<generated>)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:208)
... 29 more
Caused by: java.lang.ClassCastException
... 31 more
[b]Name and version of the database you are using:[/b]
Oracle 9
[b]The generated SQL (show_sql=true):[/b]
[b]Debug level Hibernate log excerpt:[/b]
|
|