Hibernate version:3.0.5
Mapping documents: Schedule Mapping <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping auto-import="false" default-cascade="all-delete-orphan" default-lazy="false"> <class name="org.fpml._2004.fpml_4_1.Schedule" table="Schedule"> <id name="Hjid" type="org.hibernate.type.LongType"> <generator class="native"/> </id> <discriminator type="org.hibernate.type.StringType"> <column name="Hjtype"/> </discriminator> <version name="Hjversion" type="org.hibernate.type.LongType"/> <property name="InitialValue"> <column name="InitialValue"/> <type name="org.hibernate.type.BigDecimalType"/> </property> <subclass discriminator-value="org.fpml._2004.fpml_4_1.Schedule" name="org.fpml._2004.fpml_4_1.impl.ScheduleImpl"/> </class> </hibernate-mapping>
Notonial Mapping <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping auto-import="false" default-cascade="all-delete-orphan" default-lazy="false"> <class name="org.fpml._2004.fpml_4_1.Notional" table="Notional"> <id name="Hjid" type="org.hibernate.type.LongType"> <generator class="native"/> </id> <discriminator type="org.hibernate.type.StringType"> <column name="Hjtype"/> </discriminator> <version name="Hjversion" type="org.hibernate.type.LongType"/> <many-to-one class="org.fpml._2004.fpml_4_1.AmountSchedule" name="NotionalStepSchedule"> <column name="NotionalStepSchedule"/> </many-to-one> <property name="Id"> <column name="Id"/> <type name="org.hibernate.type.StringType"/> </property> <subclass discriminator-value="org.fpml._2004.fpml_4_1.Notional" name="org.fpml._2004.fpml_4_1.impl.NotionalImpl"/> </class> </hibernate-mapping>
Amount Schedule mapping <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping auto-import="false" default-cascade="all-delete-orphan" default-lazy="false"> <subclass extends="org.fpml._2004.fpml_4_1.Schedule" name="org.fpml._2004.fpml_4_1.AmountSchedule"> <join table="AmountSchedule"> <key> <column name="Hjid"/> </key> <many-to-one class="org.fpml._2004.fpml_4_1.Currency" name="Currency"> <column name="Currency"/> </many-to-one> <property name="Id"> <column name="Id"/> <type name="org.hibernate.type.StringType"/> </property> </join> <subclass discriminator-value="org.fpml._2004.fpml_4_1.AmountSchedule" name="org.fpml._2004.fpml_4_1.impl.AmountScheduleImpl"/> </subclass> </hibernate-mapping>
Calculation mapping <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping auto-import="false" default-cascade="all-delete-orphan" default-lazy="false"> <class name="org.fpml._2004.fpml_4_1.Calculation" table="Calculation"> <id name="Hjid" type="org.hibernate.type.LongType"> <generator class="native"/> </id> <discriminator type="org.hibernate.type.StringType"> <column name="Hjtype"/> </discriminator> <version name="Hjversion" type="org.hibernate.type.LongType"/> <many-to-one class="org.fpml._2004.fpml_4_1.Notional" name="NotionalSchedule"> <column name="NotionalSchedule"/> </many-to-one> <many-to-one class="org.fpml._2004.fpml_4_1.Schedule" name="FixedRateSchedule"> <column name="FixedRateSchedule"/> </many-to-one> <many-to-one class="org.fpml._2004.fpml_4_1.FloatingRateCalculation" name="FloatingRateCalculation"> <column name="FloatingRateCalculation"/> </many-to-one> <many-to-one class="org.fpml._2004.fpml_4_1.DayCountFraction" name="DayCountFraction"> <column name="DayCountFraction"/> </many-to-one> <subclass discriminator-value="org.fpml._2004.fpml_4_1.Calculation" name="org.fpml._2004.fpml_4_1.impl.CalculationImpl"/> </class> </hibernate-mapping>
Code between sessionFactory.openSession() and session.close(): session.save(calculation1); session.save(calculation2);
Full stack trace of any exception that occurs: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.fpml._2004.fpml_4_1.impl.ScheduleImpl#4] at org.hibernate.engine.PersistenceContext.checkUniqueness(PersistenceContext.java:586) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:243) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:96) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468) at org.hibernate.engine.Cascades$5.cascade(Cascades.java:154) at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771) at org.hibernate.engine.Cascades.cascade(Cascades.java:720) at org.hibernate.engine.Cascades.cascade(Cascades.java:847) at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:332) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:214) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476) at test.calyon.irdedtp.fpml.Persister.save(Persister.java:105) at test.calyon.irdedtp.fpml.PersistenceTest.save(PersistenceTest.java:23) at test.calyon.irdedtp.fpml.PersistenceTest.main(PersistenceTest.java:30)
Name and version of the database you are using: Sybase 12.5 & jConnect 6.0
The generated SQL (show_sql=true): Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.CurrencyImpl */ insert into Currency (Hjversion, Value, CurrencyScheme, Hjtype) values (?, ?, ?, 'org.fpml._2004.fpml_4_1.Currency') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.AmountScheduleImpl */ insert into Schedule (Hjversion, InitialValue, Hjtype) values (?, ?, 'org.fpml._2004.fpml_4_1.AmountSchedule') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.AmountScheduleImpl */ insert into AmountSchedule (Currency, Id, Hjid) values (?, ?, ?) Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.NotionalImpl */ insert into Notional (Hjversion, NotionalStepSchedule, Id, Hjtype) values (?, ?, ?, 'org.fpml._2004.fpml_4_1.Notional') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.FloatingRateIndexImpl */ insert into FloatingRateIndex (Hjversion, Value, FloatingRateIndexScheme, Hjtype) values (?, ?, ?, 'org.fpml._2004.fpml_4_1.FloatingRateIndex') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.FloatingRateCalculationImpl */ insert into FloatingRate (Hjversion, FloatingRateIndex, Id, Hjtype) values (?, ?, ?, 'org.fpml._2004.fpml_4_1.FloatingRateCalculation') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.DayCountFractionImpl */ insert into DayCountFraction (Hjversion, Value, DayCountFractionScheme, Hjtype) values (?, ?, ?, 'org.fpml._2004.fpml_4_1.DayCountFraction') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.CalculationImpl */ insert into Calculation (Hjversion, NotionalSchedule, FixedRateSchedule, FloatingRateCalculation, DayCountFraction, Hjtype) values (?, ?, ?, ?, ?, 'org.fpml._2004.fpml_4_1.Calculation') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.CurrencyImpl */ insert into Currency (Hjversion, Value, CurrencyScheme, Hjtype) values (?, ?, ?, 'org.fpml._2004.fpml_4_1.Currency') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.AmountScheduleImpl */ insert into Schedule (Hjversion, InitialValue, Hjtype) values (?, ?, 'org.fpml._2004.fpml_4_1.AmountSchedule') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.AmountScheduleImpl */ insert into AmountSchedule (Currency, Id, Hjid) values (?, ?, ?) Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.NotionalImpl */ insert into Notional (Hjversion, NotionalStepSchedule, Id, Hjtype) values (?, ?, ?, 'org.fpml._2004.fpml_4_1.Notional') select @@identity Hibernate: /* insert org.fpml._2004.fpml_4_1.impl.ScheduleImpl */ insert into Schedule (Hjversion, InitialValue, Hjtype) values (?, ?, 'org.fpml._2004.fpml_4_1.Schedule') select @@identity
Debug level Hibernate log excerpt: 18:25:04,014 INFO - Hibernate 3.0.5 18:25:04,014 INFO - hibernate.properties not found 18:25:04,014 INFO - using CGLIB reflection optimizer 18:25:04,030 INFO - using JDK 1.4 java.sql.Timestamp handling 18:25:04,249 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\AmountSchedule.hbm.xml 18:25:04,405 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:04,421 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:04,639 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\Calculation.hbm.xml 18:25:04,655 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:04,655 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:04,733 INFO - Mapping class: org.fpml._2004.fpml_4_1.Calculation -> Calculation 18:25:04,749 DEBUG - Mapped property: Hjid -> Hjid 18:25:04,749 DEBUG - Mapped property: Hjversion -> Hjversion 18:25:04,952 DEBUG - Mapped property: NotionalSchedule -> NotionalSchedule 18:25:04,952 DEBUG - Mapped property: FixedRateSchedule -> FixedRateSchedule 18:25:04,952 DEBUG - Mapped property: FloatingRateCalculation -> FloatingRateCalculation 18:25:04,952 DEBUG - Mapped property: DayCountFraction -> DayCountFraction 18:25:05,030 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.CalculationImpl -> Calculation 18:25:05,046 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\Currency.hbm.xml 18:25:05,046 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:05,061 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:05,077 INFO - Mapping class: org.fpml._2004.fpml_4_1.Currency -> Currency 18:25:05,093 DEBUG - Mapped property: Hjid -> Hjid 18:25:05,093 DEBUG - Mapped property: Hjversion -> Hjversion 18:25:05,093 DEBUG - Mapped property: Value -> Value 18:25:05,093 DEBUG - Mapped property: CurrencyScheme -> CurrencyScheme 18:25:05,093 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.CurrencyImpl -> Currency 18:25:05,093 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\DayCountFraction.hbm.xml 18:25:05,108 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:05,108 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:05,139 INFO - Mapping class: org.fpml._2004.fpml_4_1.DayCountFraction -> DayCountFraction 18:25:05,139 DEBUG - Mapped property: Hjid -> Hjid 18:25:05,139 DEBUG - Mapped property: Hjversion -> Hjversion 18:25:05,139 DEBUG - Mapped property: Value -> Value 18:25:05,155 DEBUG - Mapped property: DayCountFractionScheme -> DayCountFractionScheme 18:25:05,155 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.DayCountFractionImpl -> DayCountFraction 18:25:05,155 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\FloatingRate.hbm.xml 18:25:05,155 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:05,171 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:05,186 INFO - Mapping class: org.fpml._2004.fpml_4_1.FloatingRate -> FloatingRate 18:25:05,186 DEBUG - Mapped property: Hjid -> Hjid 18:25:05,186 DEBUG - Mapped property: Hjversion -> Hjversion 18:25:05,186 DEBUG - Mapped property: FloatingRateIndex -> FloatingRateIndex 18:25:05,186 DEBUG - Mapped property: Id -> Id 18:25:05,186 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.FloatingRateImpl -> FloatingRate 18:25:05,202 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\FloatingRateCalculation.hbm.xml 18:25:05,202 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:05,202 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:05,218 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.FloatingRateCalculation -> FloatingRate 18:25:05,218 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.FloatingRateCalculationImpl -> FloatingRate 18:25:05,218 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\FloatingRateIndex.hbm.xml 18:25:05,233 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:05,233 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:05,249 INFO - Mapping class: org.fpml._2004.fpml_4_1.FloatingRateIndex -> FloatingRateIndex 18:25:05,249 DEBUG - Mapped property: Hjid -> Hjid 18:25:05,249 DEBUG - Mapped property: Hjversion -> Hjversion 18:25:05,249 DEBUG - Mapped property: Value -> Value 18:25:05,249 DEBUG - Mapped property: FloatingRateIndexScheme -> FloatingRateIndexScheme 18:25:05,249 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.FloatingRateIndexImpl -> FloatingRateIndex 18:25:05,264 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\Notional.hbm.xml 18:25:05,264 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:05,296 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:05,311 INFO - Mapping class: org.fpml._2004.fpml_4_1.Notional -> Notional 18:25:05,311 DEBUG - Mapped property: Hjid -> Hjid 18:25:05,327 DEBUG - Mapped property: Hjversion -> Hjversion 18:25:05,327 DEBUG - Mapped property: NotionalStepSchedule -> NotionalStepSchedule 18:25:05,327 DEBUG - Mapped property: Id -> Id 18:25:05,327 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.NotionalImpl -> Notional 18:25:05,327 INFO - Mapping file: generated\hbm\org\fpml\_2004\fpml_4_1\Schedule.hbm.xml 18:25:05,327 DEBUG - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/ 18:25:05,327 DEBUG - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath 18:25:05,358 INFO - Mapping class: org.fpml._2004.fpml_4_1.Schedule -> Schedule 18:25:05,358 DEBUG - Mapped property: Hjid -> Hjid 18:25:05,358 DEBUG - Mapped property: Hjversion -> Hjversion 18:25:05,358 DEBUG - Mapped property: InitialValue -> InitialValue 18:25:05,358 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.ScheduleImpl -> Schedule 18:25:05,358 DEBUG - Preparing to build session factory with filters : {} 18:25:05,358 INFO - processing extends queue 18:25:05,358 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.AmountSchedule -> Schedule 18:25:05,358 INFO - Mapping class join: org.fpml._2004.fpml_4_1.AmountSchedule -> AmountSchedule 18:25:05,374 DEBUG - Mapped property: Currency -> Currency 18:25:05,374 DEBUG - Mapped property: Id -> Id 18:25:05,374 INFO - Mapping subclass: org.fpml._2004.fpml_4_1.impl.AmountScheduleImpl -> Schedule 18:25:05,374 INFO - processing collection mappings 18:25:05,374 INFO - processing association property references 18:25:05,374 INFO - processing foreign key constraints 18:25:05,374 DEBUG - resolving reference to class: org.fpml._2004.fpml_4_1.AmountSchedule 18:25:05,374 DEBUG - resolving reference to class: org.fpml._2004.fpml_4_1.Currency 18:25:05,374 DEBUG - resolving reference to class: org.fpml._2004.fpml_4_1.Schedule 18:25:05,374 DEBUG - resolving reference to class: org.fpml._2004.fpml_4_1.Notional 18:25:05,374 DEBUG - resolving reference to class: org.fpml._2004.fpml_4_1.DayCountFraction 18:25:05,389 DEBUG - resolving reference to class: org.fpml._2004.fpml_4_1.FloatingRateCalculation 18:25:05,389 DEBUG - resolving reference to class: org.fpml._2004.fpml_4_1.FloatingRateIndex 18:25:05,389 DEBUG - resolving reference to class: org.fpml._2004.fpml_4_1.AmountSchedule 18:25:05,436 INFO - Using Hibernate built-in connection pool (not for production use!) 18:25:05,436 INFO - Hibernate connection pool size: 20 18:25:05,436 INFO - autocommit mode: false 18:25:05,499 INFO - using driver: com.sybase.jdbc3.jdbc.SybDriver at URL: ##################### 18:25:05,499 INFO - connection properties: {user=############, password=###########} 18:25:05,499 DEBUG - total checked-out connections: 0 18:25:05,514 DEBUG - opening new JDBC connection 18:25:05,952 DEBUG - created connection to: #############################, Isolation Level: 2 18:25:05,999 DEBUG - could not get database version from JDBC metadata 18:25:05,999 INFO - RDBMS: Adaptive Server Enterprise, version: Adaptive Server Enterprise/12.5.3/EBF 13067 ESD#5/P/ia64/HP-UX B.11.23/ase1253/1939/64-bit/FBO/Tue Dec 6 02:53:02 2005 18:25:05,999 INFO - JDBC driver: jConnect (TM) for JDBC (TM), version: jConnect (TM) for JDBC(TM)/6.05(Build 25828)/P/EBF13044/JDK14/Fri Sep 30 1:05:16 2005 18:25:06,014 DEBUG - returning connection to pool, pool size: 1 18:25:06,061 INFO - Using dialect: org.hibernate.dialect.SybaseDialect 18:25:06,077 INFO - Using default transaction strategy (direct JDBC transactions) 18:25:06,093 INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 18:25:06,093 INFO - Automatic flush during beforeCompletion(): disabled 18:25:06,093 INFO - Automatic session close at end of transaction: disabled 18:25:06,108 INFO - Scrollable result sets: enabled 18:25:06,108 DEBUG - Wrap result sets: disabled 18:25:06,108 INFO - JDBC3 getGeneratedKeys(): disabled 18:25:06,108 INFO - Connection release mode: null 18:25:06,108 INFO - Default batch fetch size: 1 18:25:06,124 INFO - Generate SQL with comments: enabled 18:25:06,124 INFO - Order SQL updates by primary key: disabled 18:25:06,124 INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 18:25:06,139 INFO - Using ASTQueryTranslatorFactory 18:25:06,139 INFO - Query language substitutions: {} 18:25:06,139 INFO - Second-level cache: enabled 18:25:06,139 INFO - Query cache: disabled 18:25:06,139 INFO - Cache provider: org.hibernate.cache.HashtableCacheProvider 18:25:06,155 INFO - Optimize cache for minimal puts: disabled 18:25:06,155 INFO - Structured second-level cache entries: disabled 18:25:06,155 DEBUG - Using dialect defined converter 18:25:06,171 INFO - Echoing all SQL to stdout 18:25:06,171 INFO - Statistics: disabled 18:25:06,186 INFO - Deleted entity synthetic identifier rollback: disabled 18:25:06,186 INFO - Default entity-mode: pojo 18:25:06,436 INFO - building session factory 18:25:06,436 DEBUG - Session factory constructed with filter configurations : {} 18:25:06,436 DEBUG - instantiating session factory with properties: {hibernate.use_sql_comments=true, hibernate.connection.driver_class=com.sybase.jdbc3.jdbc.SybDriver, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dialect=org.hibernate.dialect.SybaseDialect, hibernate.format_sql=true, hibernate.connection.username=#####, hibernate.connection.url=#############", hibernate.show_sql=true, hibernate.connection.password=calyon} ...... ...... 18:25:08,452 DEBUG - processing cascade ACTION_SAVE_UPDATE for: org.fpml._2004.fpml_4_1.impl.AmountScheduleImpl 18:25:08,452 DEBUG - done processing cascade ACTION_SAVE_UPDATE for: org.fpml._2004.fpml_4_1.impl.AmountScheduleImpl 18:25:08,452 DEBUG - done processing cascade ACTION_SAVE_UPDATE for: org.fpml._2004.fpml_4_1.impl.NotionalImpl 18:25:08,468 DEBUG - Seeding: 0 18:25:08,468 DEBUG - Inserting entity: org.fpml._2004.fpml_4_1.impl.NotionalImpl (native id) 18:25:08,468 DEBUG - Version: 0 18:25:08,468 DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0) 18:25:08,483 DEBUG - /* insert org.fpml._2004.fpml_4_1.impl.NotionalImpl */ insert into Notional (Hjversion, NotionalStepSchedule, Id, Hjtype) values (?, ?, ?, 'org.fpml._2004.fpml_4_1.Notional') select @@identity 18:25:08,483 DEBUG - preparing statement 18:25:08,483 DEBUG - Dehydrating entity: [org.fpml._2004.fpml_4_1.impl.NotionalImpl#<null>] 18:25:08,483 DEBUG - binding '0' to parameter: 1 18:25:08,483 DEBUG - binding '4' to parameter: 2 18:25:08,483 DEBUG - binding null to parameter: 3 18:25:08,483 DEBUG - Natively generated identity: 4 18:25:08,499 DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1) 18:25:08,499 DEBUG - closing statement 18:25:08,499 DEBUG - processing cascade ACTION_SAVE_UPDATE for: org.fpml._2004.fpml_4_1.impl.NotionalImpl 18:25:08,499 DEBUG - done processing cascade ACTION_SAVE_UPDATE for: org.fpml._2004.fpml_4_1.impl.NotionalImpl 18:25:08,499 DEBUG - cascading to saveOrUpdate: org.fpml._2004.fpml_4_1.Schedule 18:25:08,499 DEBUG - transient instance of: org.fpml._2004.fpml_4_1.Schedule 18:25:08,514 DEBUG - saving transient instance 18:25:08,514 DEBUG - saving [org.fpml._2004.fpml_4_1.impl.ScheduleImpl#<null>] 18:25:08,514 DEBUG - executing insertions 18:25:08,514 DEBUG - processing cascade ACTION_SAVE_UPDATE for: org.fpml._2004.fpml_4_1.impl.ScheduleImpl 18:25:08,514 DEBUG - done processing cascade ACTION_SAVE_UPDATE for: org.fpml._2004.fpml_4_1.impl.ScheduleImpl 18:25:08,514 DEBUG - Seeding: 0 18:25:08,530 DEBUG - Inserting entity: org.fpml._2004.fpml_4_1.impl.ScheduleImpl (native id) 18:25:08,530 DEBUG - Version: 0 18:25:08,530 DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0) 18:25:08,530 DEBUG - /* insert org.fpml._2004.fpml_4_1.impl.ScheduleImpl */ insert into Schedule (Hjversion, InitialValue, Hjtype) values (?, ?, 'org.fpml._2004.fpml_4_1.Schedule') select @@identity 18:25:08,530 DEBUG - preparing statement 18:25:08,530 DEBUG - Dehydrating entity: [org.fpml._2004.fpml_4_1.impl.ScheduleImpl#<null>] 18:25:08,530 DEBUG - binding '0' to parameter: 1 18:25:08,530 DEBUG - binding '0.050999999999999996724842077355788205750286579132080078125' to parameter: 2 18:25:08,546 DEBUG - Natively generated identity: 4 18:25:08,546 DEBUG - about to close PreparedStatement (open PreparedStatements: 1, globally: 1) 18:25:08,546 DEBUG - closing statement
##############################################
I tried to make the example as short as possible in order to reproduce my problem. Basically I got a Calculation object which contains a AmountSchedule and a Schedule objects ; AmountSchedule is a subclass of Schedule.
When trying to insert a calculation object, Hibernate try to persist both a AmountSchedule and a Schedule objects ; unfortunately for an unknow reason (at least for me), it seems that the same native id is generated (4 in the traces) for the two objects.
Maybe I'm not using the good id generator, maybe my mapping is wrong but as a new user to Hibernate I can figure out what it may come from.
PS : The classes and hbm files are all generated with hyperxajb2 version 0.2
Any help is welcome. For more precison don't hesitate to ask :)
Last edited by laurentj on Tue Jun 02, 2015 3:38 am, edited 2 times in total.
|