-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Problem saving cascade associations
PostPosted: Thu Aug 26, 2004 10:38 am 
Newbie

Joined: Thu Aug 26, 2004 9:25 am
Posts: 8
Hi all,
I'm getting a foreign key constraint error at DB Level when I try to save an Agente (see below). As you see an Agente has a many-to-one association to DatosPersonales implemented by foreign key on column datospersonalesID of table Agente. Both Agente and Datos Personales has native generated surrogate primary-key.
When I try to save an agent, Hibernate does save first DatosPersonales associated object (until this moment both transient objects with non primary-key generated), but It doesn't refresh the object DatosPersonales at session with the new generated key. So when It try to save Agente, in order to insert this data on field datospersonalesID of table Agente (foreign key on DatosPersonales) I'm getting the fk constraint error returned by the DB.

Thanks in advance.

Hibernate version: 2.1.3

Mapping documents:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Mapping files -->
<mapping resource="model/TipoDocumento.hbm.xml"/>
<mapping resource="model/DatosPersonales.hbm.xml"/>
<mapping resource="model/TipoAnsesCode.hbm.xml"/>
<mapping resource="model/TipoEstadoCivil.hbm.xml"/>
<mapping resource="model/TipoACargo.hbm.xml"/>
<mapping resource="model/TipoEscolaridad.hbm.xml"/>
<mapping resource="model/Agente.hbm.xml"/>
<mapping resource="model/Familiar.hbm.xml"/>
<mapping resource="model/TipoParentesco.hbm.xml"/>
<mapping resource="model/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="model">

<class name="Agente" table="Agente"
discriminator-value="N">
<id name="internalId">
<generator class="native"/>
</id>
<property name="log"> <column name="log" length="24" />
</property>
<property name="foja"> <column name="foja" length="6" />
</property>
<property name="fechaIngreso"> <column name="fechaIngreso"
length="8" />
</property>
<many-to-one name="datosPersonales" class="model.DatosPersonales"
cascade="save-update" column="datosPersonalesId" />
<set name="familiares">
<key column="agenteId"/>
<one-to-many class="model.Familiar"/>
</set>
</class>
</hibernate-mapping>


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
package="model">

<class name="DatosPersonales" table="DatosPersonales"
discriminator-value="N">
<id name="internalId">
<generator class="native"/>
</id>
<property name="log"> <column name="log" length="24" />
</property>
<property name="sexo"> <column name="sexo" length="1" not-
null="true"/>
</property>
<property name="vigencia"> <column name="vigencia" not-
null="true"/>
</property>
<property name="fechaNacimiento"> <column
name="fechaNacimiento" length="8" not-null="true"/>
</property>
<property name="nacionalidad"> <column name="nacionalidad"
length="15" not-null="true"/>
</property>
<property name="exCombatiente"> <column name="exCombatiente"
length="1" /> </property>
<property name="email"> <column name="email" length="50" />
</property>
<component name="documento" class="model.Documento">
<property name="numero"> <column name="documento" length="8"
not-null="true" unique="true" />
</property>
<many-to-one name="tipoDocumento" class="model.TipoDocumento"
column="tipoDocumentoId" />
</component>
<component name="nombresYApellido" class="model.Apyn">
<property name="nombres"> <column name="nombres" length="30"
not-null="true" />
</property>
<property name="apellido"> <column name="apellido" length="20"
not-null="true" />
</property>
</component>
<component name="cartaCiudadania" class="model.CartaCiudadania">
<property name="ident"> <column name="cartaCiudadania"
length="15" />
</property>
<property name="lugarEmision"> <column
name="lugarEmisionCartaC" length="30" />
</property>
<property name="fechaEmision"> <column
name="fechaEmisionCartaC" length="8" />
</property>
<property name="juzgadoEmisor"> <column
name="juzgadoEmisorCartaC" length="20" />
</property>
</component>
<component name="ansesCode" class="model.AnsesCode">
<property name="numero"> <column name="AnsesCode"
length="13" />
</property>
<many-to-one name="tipoAnsesCode" class="model.TipoAnsesCode"
column="tipoAnsesCodeId" />
</component>
<component name="discapacidad" class="model.Discapacidad">
<property name="id"> <column name="discapacidad"
length="3" />
</property>
<property name="description"> <column name="descDiscapacidad"
length="40" />
</property>
<property name="vigencia"> <column name="vigDiscapacidad" />
</property>
</component>
<set name="movDomicilio" table="Direccion" lazy="false">
<key column="datosPersonalesId" />
<composite-element class="model.Direccion">
<property name="vigencia"> <column name="vigDomicilio" />
</property>
<property name="calle"> <column name="calle"
length="30" />
</property>
<property name="numero"> <column name="numero"
length="10" />
</property>
<property name="departamento"> <column
name="departamento" length="2" />
</property>
<property name="piso"> <column name="piso" length="5" />
</property>
<property name="monoblock"> <column name="monoblock"
length="2" />
</property>
<property name="torre"> <column name="torre"
length="2" />
</property>
<property name="tira"> <column name="tira" length="2" />
</property>
<property name="manzana"> <column name="manzana"
length="2" />
</property>
<property name="localidad"> <column name="localidad"
length="20" />
</property>
<property name="codigoPostal"> <column
name="codigoPostal" length="5" />
</property>
<property name="provincia"> <column name="provincia"
length="20" />
</property>
<property name="telediscado"> <column name="telediscado"
length="5" />
</property>
<property name="telefono"> <column name="telefono"
length="15" />
</property>
</composite-element>
</set>
<set name="movEstadoCivil" table="EstadoCivil" lazy="false">
<key column="datosPersonalesId" />
<composite-element class="model.EstadoCivil">
<property name="vigencia"> <column
name="vigEstadoCivil" /> </property>
<many-to-one name="tipoEstadoCivil"
class="model.TipoEstadoCivil" column="tipoEstadoCivilId" />
</composite-element>
</set>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Agente ag = (Agente) obj;
try {
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
session.save(ag);
tx.commit();
HibernateUtil.closeSession();
} catch (Exception e) {
System.out.println("EXCEPTION!!! on write de Agente: ");
e.printStackTrace();
}



Full stack trace of any exception that occurs:
26/08/2004 11:24:26 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.3
26/08/2004 11:24:26 net.sf.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.ibm.db2.jcc.DB2Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=mpisano, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:db2://dbserver.ed.gba.gov.ar:50000/edu_desa, hibernate.connection.password=corto, hibernate.connection.pool_size=1}
26/08/2004 11:24:26 net.sf.hibernate.cfg.Environment <clinit>
INFO: using java.io streams to persist binary types
26/08/2004 11:24:26 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
26/08/2004 11:24:26 net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
26/08/2004 11:24:26 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
26/08/2004 11:24:26 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/TipoDocumento.hbm.xml
26/08/2004 11:24:27 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.TipoDocumento -> TipoDocumento
26/08/2004 11:24:27 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/DatosPersonales.hbm.xml
26/08/2004 11:24:27 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.DatosPersonales -> DatosPersonales
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindCollection
INFO: Mapping collection: model.DatosPersonales.movDomicilio -> Direccion
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindCollection
INFO: Mapping collection: model.DatosPersonales.movEstadoCivil -> EstadoCivil
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/TipoAnsesCode.hbm.xml
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.TipoAnsesCode -> TipoAnsesCode
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/TipoEstadoCivil.hbm.xml
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.TipoEstadoCivil -> TipoEstadoCivil
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/TipoACargo.hbm.xml
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.TipoACargo -> TipoACargo
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/TipoEscolaridad.hbm.xml
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.TipoEscolaridad -> TipoEscolaridad
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Agente.hbm.xml
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.Agente -> Agente
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Familiar.hbm.xml
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.Familiar -> Familiar
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindCollection
INFO: Mapping collection: model.Familiar.movParentesco -> Parentesco
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindCollection
INFO: Mapping collection: model.Familiar.movMotivoACargo -> MotivoACargo
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/TipoParentesco.hbm.xml
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.TipoParentesco -> TipoParentesco
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/User.hbm.xml
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: model.User -> User
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindCollection
INFO: Mapping collection: model.User.roles -> Roles
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
26/08/2004 11:24:28 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
26/08/2004 11:24:28 net.sf.hibernate.cfg.Binder bindCollectionSecondPass
INFO: Mapping collection: model.Agente.familiares -> Familiar
26/08/2004 11:24:29 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
26/08/2004 11:24:29 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
26/08/2004 11:24:29 net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.DB2Dialect
26/08/2004 11:24:29 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximim outer join fetch depth: 1
26/08/2004 11:24:29 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: true
26/08/2004 11:24:29 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
26/08/2004 11:24:29 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 1
26/08/2004 11:24:29 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.ibm.db2.jcc.DB2Driver at URL: jdbc:db2://dbserver.ed.gba.gov.ar:50000/edu_desa
26/08/2004 11:24:29 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=mpisano, password=corto}
26/08/2004 11:24:29 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
26/08/2004 11:24:30 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
26/08/2004 11:24:30 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
26/08/2004 11:24:30 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
26/08/2004 11:24:30 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {no='N', true=1, yes='Y', false=0}
26/08/2004 11:24:30 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.ehcache.hibernate.Provider
26/08/2004 11:24:30 net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
26/08/2004 11:24:30 net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
26/08/2004 11:24:31 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: no JNDI name configured
26/08/2004 11:24:31 net.sf.hibernate.cache.UpdateTimestampsCache <init>
INFO: starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
26/08/2004 11:24:31 net.sf.ehcache.hibernate.Plugin <init>
ADVERTENCIA: Could not find configuration for net.sf.hibernate.cache.UpdateTimestampsCache. Configuring using the defaultCache settings.
26/08/2004 11:24:31 net.sf.hibernate.cache.QueryCache <init>
INFO: starting query cache at region: net.sf.hibernate.cache.QueryCache
26/08/2004 11:24:31 net.sf.ehcache.hibernate.Plugin <init>
ADVERTENCIA: Could not find configuration for net.sf.hibernate.cache.QueryCache. Configuring using the defaultCache settings.
26/08/2004 11:24:31 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
ADVERTENCIA: SQL Error: -530, SQLState: 23503
26/08/2004 11:24:31 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
GRAVE: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: MPISANO.AGENTE.FK74C60A20C07A4404
26/08/2004 11:24:31 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
ADVERTENCIA: SQL Error: -530, SQLState: 23503
26/08/2004 11:24:31 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
GRAVE: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: MPISANO.AGENTE.FK74C60A20C07A4404
26/08/2004 11:24:31 net.sf.hibernate.JDBCException <init>
GRAVE: could not insert: [model.Agente]
com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: MPISANO.AGENTE.FK74C60A20C07A4404
at com.ibm.db2.jcc.a.cq.d(cq.java:1234)
at com.ibm.db2.jcc.c.bc.k(bc.java:345)
at com.ibm.db2.jcc.c.bc.a(bc.java:63)
at com.ibm.db2.jcc.c.q.a(q.java:64)
at com.ibm.db2.jcc.c.bp.c(bp.java:266)
at com.ibm.db2.jcc.a.cr.V(cr.java:1412)
at com.ibm.db2.jcc.a.cr.d(cr.java:1939)
at com.ibm.db2.jcc.a.cr.R(cr.java:440)
at com.ibm.db2.jcc.a.cr.executeUpdate(cr.java:423)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:526)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:925)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:850)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:768)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:731)
at model.AgentePersisterImpl.write(AgentePersisterImpl.java:51)
at model.MainWrite.main(MainWrite.java:221)
net.sf.hibernate.JDBCException: could not insert: [model.Agente]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:556)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:925)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:850)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:768)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:731)
at model.AgentePersisterImpl.write(AgentePersisterImpl.java:51)
at model.MainWrite.main(MainWrite.java:221)
Caused by: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: MPISANO.AGENTE.FK74C60A20C07A4404
at com.ibm.db2.jcc.a.cq.d(cq.java:1234)
at com.ibm.db2.jcc.c.bc.k(bc.java:345)
at com.ibm.db2.jcc.c.bc.a(bc.java:63)
at com.ibm.db2.jcc.c.q.a(q.java:64)
at com.ibm.db2.jcc.c.bp.c(bp.java:266)
at com.ibm.db2.jcc.a.cr.V(cr.java:1412)
at com.ibm.db2.jcc.a.cr.d(cr.java:1939)
at com.ibm.db2.jcc.a.cr.R(cr.java:440)
at com.ibm.db2.jcc.a.cr.executeUpdate(cr.java:423)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:526)
... 8 more
EXCEPTION!!! on write de Agente:


NOTE: the foreign key exception is on datosPersonalesID of table agente !
Please see the mappings files above.


Name and version of the database you are using: DB2

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 26, 2004 10:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please trim your code down to just what is relevant to the error. TIA


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 26, 2004 10:56 am 
Newbie

Joined: Thu Aug 26, 2004 9:25 am
Posts: 8
gavin wrote:
Please trim your code down to just what is relevant to the error. TIA


sorry, I'm new posting here...

Hibernate version: 2.1.3

Mapping documents:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Mapping files -->
<mapping resource="model/TipoDocumento.hbm.xml"/>
<mapping resource="model/DatosPersonales.hbm.xml"/>
<mapping resource="model/TipoAnsesCode.hbm.xml"/>
<mapping resource="model/TipoEstadoCivil.hbm.xml"/>
<mapping resource="model/TipoACargo.hbm.xml"/>
<mapping resource="model/TipoEscolaridad.hbm.xml"/>
<mapping resource="model/Agente.hbm.xml"/>
<mapping resource="model/Familiar.hbm.xml"/>
<mapping resource="model/TipoParentesco.hbm.xml"/>
<mapping resource="model/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="model">

<class name="Agente" table="Agente"
discriminator-value="N">
<id name="internalId">
<generator class="native"/>
</id>
<property name="log"> <column name="log" length="24" />
</property>
<property name="foja"> <column name="foja" length="6" />
</property>
<property name="fechaIngreso"> <column name="fechaIngreso"
length="8" />
</property>
<many-to-one name="datosPersonales" class="model.DatosPersonales"
cascade="save-update" column="datosPersonalesId" />
....
</class>
</hibernate-mapping>


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
package="model">

<class name="DatosPersonales" table="DatosPersonales"
discriminator-value="N">
<id name="internalId">
<generator class="native"/>
</id>
......
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Agente ag = (Agente) obj;
try {
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
session.save(ag);
tx.commit();
HibernateUtil.closeSession();
} catch (Exception e) {
System.out.println("EXCEPTION!!! on write de Agente: ");
e.printStackTrace();
}




ADVERTENCIA: SQL Error: -530, SQLState: 23503
26/08/2004 11:24:31 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
GRAVE: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: MPISANO.AGENTE.FK74C60A20C07A4404
26/08/2004 11:24:31 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
ADVERTENCIA: SQL Error: -530, SQLState: 23503
26/08/2004 11:24:31 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
GRAVE: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: MPISANO.AGENTE.FK74C60A20C07A4404
26/08/2004 11:24:31 net.sf.hibernate.JDBCException <init>
GRAVE: could not insert: [model.Agente]
com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: MPISANO.AGENTE.FK74C60A20C07A4404
at com.ibm.db2.jcc.a.cq.d(cq.java:1234)
at com.ibm.db2.jcc.c.bc.k(bc.java:345)
at com.ibm.db2.jcc.c.bc.a(bc.java:63)
at com.ibm.db2.jcc.c.q.a(q.java:64)
at com.ibm.db2.jcc.c.bp.c(bp.java:266)
at com.ibm.db2.jcc.a.cr.V(cr.java:1412)
at com.ibm.db2.jcc.a.cr.d(cr.java:1939)
at com.ibm.db2.jcc.a.cr.R(cr.java:440)
at com.ibm.db2.jcc.a.cr.executeUpdate(cr.java:423)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:526)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:925)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:850)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:768)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:731)
at model.AgentePersisterImpl.write(AgentePersisterImpl.java:51)
at model.MainWrite.main(MainWrite.java:221)
net.sf.hibernate.JDBCException: could not insert: [model.Agente]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:556)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:925)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:850)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:768)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:731)
at model.AgentePersisterImpl.write(AgentePersisterImpl.java:51)
at model.MainWrite.main(MainWrite.java:221)
Caused by: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: MPISANO.AGENTE.FK74C60A20C07A4404
at com.ibm.db2.jcc.a.cq.d(cq.java:1234)
at com.ibm.db2.jcc.c.bc.k(bc.java:345)
at com.ibm.db2.jcc.c.bc.a(bc.java:63)
at com.ibm.db2.jcc.c.q.a(q.java:64)
at com.ibm.db2.jcc.c.bp.c(bp.java:266)
at com.ibm.db2.jcc.a.cr.V(cr.java:1412)
at com.ibm.db2.jcc.a.cr.d(cr.java:1939)
at com.ibm.db2.jcc.a.cr.R(cr.java:440)
at com.ibm.db2.jcc.a.cr.executeUpdate(cr.java:423)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:526)
... 8 more
EXCEPTION!!! on write de Agente:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.