I am importing an XML document, and I am having two problems.
1. Hibernate is ignoring embedded id's and generating new ones
2. Hibernate is not reading the second Object in a many-one relationship
We need to embed the id (foreign key) in order to create relationships between objects where we do not cascade on save.
32500 [Main Thread] DEBUG transaction.JDBCTransaction - begin
32500 [Main Thread] DEBUG jdbc.ConnectionManager - opening JDBC connection
32500 [Main Thread] DEBUG connection.DriverManagerConnectionProvider - total checked-out connections: 0
32500 [Main Thread] DEBUG connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
32500 [Main Thread] DEBUG transaction.JDBCTransaction - current autocommit status: false
32594 [Main Thread] DEBUG def.AbstractSaveEventListener - transient instance of: com.valuelink.nextrends.cdom.common.models.ContactInfo
32594 [Main Thread] DEBUG def.DefaultPersistEventListener - saving transient instance
32609 [Main Thread] DEBUG jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
32625 [Main Thread] DEBUG hibernate.SQL - select seq_contactinfo.nextval from dual
32625 [Main Thread] DEBUG jdbc.AbstractBatcher - preparing statement
33078 [Main Thread] DEBUG id.SequenceGenerator - Sequence identifier generated: 26
33078 [Main Thread] DEBUG jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
33078 [Main Thread] DEBUG jdbc.AbstractBatcher - closing statement
33094 [Main Thread] DEBUG def.AbstractSaveEventListener - generated identifier: 26, using strategy: org.hibernate.id.SequenceGenerator
33094 [Main Thread] DEBUG def.AbstractSaveEventListener - saving [com.valuelink.nextrends.cdom.common.models.ContactInfo#26]
33109 [Main Thread] DEBUG engine.Cascades - processing cascade ACTION_PERSIST for: com.valuelink.nextrends.cdom.common.models.ContactInfo
33125 [Main Thread] DEBUG engine.Cascades - done processing cascade ACTION_PERSIST for: com.valuelink.nextrends.cdom.common.models.ContactInfo
33125 [Main Thread] DEBUG engine.Versioning - Seeding: 0
33156 [Main Thread] DEBUG engine.Cascades - processing cascade ACTION_PERSIST for: com.valuelink.nextrends.cdom.common.models.ContactInfo
33156 [Main Thread] DEBUG engine.Cascades - done processing cascade ACTION_PERSIST for: com.valuelink.nextrends.cdom.common.models.ContactInfo
33156 [Main Thread] DEBUG transaction.JDBCTransaction - commit
33156 [Main Thread] DEBUG impl.SessionImpl - automatically flushing session
33156 [Main Thread] DEBUG def.AbstractFlushingEventListener - flushing session
33156 [Main Thread] DEBUG def.AbstractFlushingEventListener - processing flush-time cascades
33156 [Main Thread] DEBUG engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: com.valuelink.nextrends.cdom.common.models.ContactInfo
33172 [Main Thread] DEBUG engine.Cascades - cascading to saveOrUpdate: com.valuelink.nextrends.cdom.common.models.Address
33172 [Main Thread] DEBUG def.AbstractSaveEventListener - transient instance of: com.valuelink.nextrends.cdom.common.models.Address
33172 [Main Thread] DEBUG def.DefaultSaveOrUpdateEventListener - saving transient instance
33172 [Main Thread] DEBUG jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
33172 [Main Thread] DEBUG hibernate.SQL - select seq_address.nextval from dual
33172 [Main Thread] DEBUG jdbc.AbstractBatcher - preparing statement
33172 [Main Thread] DEBUG id.SequenceGenerator - Sequence identifier generated: 13
33172 [Main Thread] DEBUG jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
33172 [Main Thread] DEBUG jdbc.AbstractBatcher - closing statement
33172 [Main Thread] DEBUG def.AbstractSaveEventListener - generated identifier: 13, using strategy: org.hibernate.id.SequenceGenerator
33172 [Main Thread] DEBUG def.AbstractSaveEventListener - saving [com.valuelink.nextrends.cdom.common.models.Address#13]
33172 [Main Thread] DEBUG engine.Versioning - Seeding: 0
33172 [Main Thread] DEBUG engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: com.valuelink.nextrends.cdom.common.models.ContactInfo
33344 [Main Thread] DEBUG def.AbstractFlushingEventListener - dirty checking collections
33344 [Main Thread] DEBUG def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
33375 [Main Thread] DEBUG entity.BasicEntityPersister - com.valuelink.nextrends.cdom.common.models.ContactInfo.address is dirty
33375 [Main Thread] DEBUG def.DefaultFlushEntityEventListener - Updating entity: [com.valuelink.nextrends.cdom.common.models.ContactInfo#26]
33375 [Main Thread] DEBUG engine.Versioning - Incrementing: 0 to 1
33391 [Main Thread] DEBUG def.AbstractFlushingEventListener - Processing unreferenced collections
33391 [Main Thread] DEBUG def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
33391 [Main Thread] DEBUG def.AbstractFlushingEventListener - Flushed: 2 insertions, 1 updates, 0 deletions to 2 objects
33391 [Main Thread] DEBUG def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
33391 [Main Thread] DEBUG pretty.Printer - listing entities:
33391 [Main Thread] DEBUG pretty.Printer - org.dom4j.tree.DefaultElement
33391 [Main Thread] DEBUG pretty.Printer - org.dom4j.tree.DefaultElement
33391 [Main Thread] DEBUG def.AbstractFlushingEventListener - executing flush
33406 [Main Thread] DEBUG entity.BasicEntityPersister - Inserting entity: [com.valuelink.nextrends.cdom.common.models.ContactInfo#26]
33406 [Main Thread] DEBUG entity.BasicEntityPersister - Version: 0
33406 [Main Thread] DEBUG jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
33406 [Main Thread] DEBUG hibernate.SQL - insert into CDOM_CONTACTINFO (recordVersion, TITLE, NAME, PHONE, FAX, EMAIL, SBMUSERNAME, ADDRESSID, AFFILIATIONTYPEID, CONTACTINFOID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
33406 [Main Thread] DEBUG jdbc.AbstractBatcher - preparing statement
33406 [Main Thread] DEBUG entity.BasicEntityPersister - Dehydrating entity: [com.valuelink.nextrends.cdom.common.models.ContactInfo#26]
33406 [Main Thread] DEBUG type.LongType - binding '0' to parameter: 1
33422 [Main Thread] DEBUG type.StringType - binding 'Card Specialist' to parameter: 2
33422 [Main Thread] DEBUG type.StringType - binding 'Raj TheTerrible' to parameter: 3
33422 [Main Thread] DEBUG type.StringType - binding '720-332-5073' to parameter: 4
33422 [Main Thread] DEBUG type.StringType - binding '720-332-0502' to parameter: 5
33422 [Main Thread] DEBUG type.StringType - binding '
[email protected]' to parameter: 6
33422 [Main Thread] DEBUG type.StringType - binding null to parameter: 7
33422 [Main Thread] DEBUG type.LongType - binding null to parameter: 8
33422 [Main Thread] DEBUG type.LongType - binding null to parameter: 9
33422 [Main Thread] DEBUG type.LongType - binding '26' to parameter: 10
33438 [Main Thread] DEBUG entity.BasicEntityPersister - Inserting entity: [com.valuelink.nextrends.cdom.common.models.Address#13]
33438 [Main Thread] DEBUG entity.BasicEntityPersister - Version: 0
33438 [Main Thread] DEBUG jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
33438 [Main Thread] DEBUG jdbc.AbstractBatcher - closing statement
33438 [Main Thread] DEBUG jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
33438 [Main Thread] DEBUG hibernate.SQL - insert into CDOM_ADDRESS (recordVersion, STREETADDRESSL1, STREETADDRESSL2, CITY, STATE, ZIPCODE, COUNTRY, ADDRESSID) values (?, ?, ?, ?, ?, ?, ?, ?)
33438 [Main Thread] DEBUG jdbc.AbstractBatcher - preparing statement
33438 [Main Thread] DEBUG entity.BasicEntityPersister - Dehydrating entity: [com.valuelink.nextrends.cdom.common.models.Address#13]
33438 [Main Thread] DEBUG type.LongType - binding '0' to parameter: 1
33438 [Main Thread] DEBUG type.StringType - binding '45 Utah Ave South' to parameter: 2
33438 [Main Thread] DEBUG type.StringType - binding null to parameter: 3
33438 [Main Thread] DEBUG type.StringType - binding 'Seattle' to parameter: 4
33438 [Main Thread] DEBUG type.StringType - binding 'WA' to parameter: 5
33438 [Main Thread] DEBUG type.StringType - binding null to parameter: 6
33438 [Main Thread] DEBUG type.StringType - binding 'USA' to parameter: 7
33438 [Main Thread] DEBUG type.LongType - binding '13' to parameter: 8
33438 [Main Thread] DEBUG jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
33438 [Main Thread] DEBUG jdbc.AbstractBatcher - closing statement
33469 [Main Thread] DEBUG entity.BasicEntityPersister - Updating entity: [com.valuelink.nextrends.cdom.common.models.ContactInfo#26]
33469 [Main Thread] DEBUG entity.BasicEntityPersister - Existing version: 0 -> New version: 1
33469 [Main Thread] DEBUG jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
33469 [Main Thread] DEBUG hibernate.SQL - update CDOM_CONTACTINFO set recordVersion=?, TITLE=?, NAME=?, PHONE=?, FAX=?, EMAIL=?, SBMUSERNAME=?, ADDRESSID=?, AFFILIATIONTYPEID=? where CONTACTINFOID=? and recordVersion=?
33469 [Main Thread] DEBUG jdbc.AbstractBatcher - preparing statement
33469 [Main Thread] DEBUG entity.BasicEntityPersister - Dehydrating entity: [com.valuelink.nextrends.cdom.common.models.ContactInfo#26]
33469 [Main Thread] DEBUG type.LongType - binding '1' to parameter: 1
33469 [Main Thread] DEBUG type.StringType - binding 'Card Specialist' to parameter: 2
33469 [Main Thread] DEBUG type.StringType - binding 'Raj TheTerrible' to parameter: 3
33469 [Main Thread] DEBUG type.StringType - binding '720-332-5073' to parameter: 4
33469 [Main Thread] DEBUG type.StringType - binding '720-332-0502' to parameter: 5
33469 [Main Thread] DEBUG type.StringType - binding '
[email protected]' to parameter: 6
33469 [Main Thread] DEBUG type.StringType - binding null to parameter: 7
33469 [Main Thread] DEBUG type.LongType - binding '13' to parameter: 8
33469 [Main Thread] DEBUG type.LongType - binding null to parameter: 9
33469 [Main Thread] DEBUG type.LongType - binding '26' to parameter: 10
33469 [Main Thread] DEBUG type.LongType - binding '0' to parameter: 11
33469 [Main Thread] DEBUG jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
33469 [Main Thread] DEBUG jdbc.AbstractBatcher - closing statement
33469 [Main Thread] DEBUG def.AbstractFlushingEventListener - post flush
33469 [Main Thread] DEBUG jdbc.JDBCContext - before transaction completion
33469 [Main Thread] DEBUG impl.SessionImpl - before transaction completion
33469 [Main Thread] DEBUG transaction.JDBCTransaction - committed JDBC Connection
33469 [Main Thread] DEBUG jdbc.JDBCContext - after transaction completion
33469 [Main Thread] DEBUG impl.SessionImpl - after transaction completion
33484 [Main Thread] DEBUG impl.SessionImpl - closing session
33484 [Main Thread] DEBUG impl.SessionImpl - closing session
33484 [Main Thread] DEBUG jdbc.ConnectionManager - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
33484 [Main Thread] DEBUG connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
33484 [Main Thread] DEBUG jdbc.JDBCContext - after transaction completion
33484 [Main Thread] DEBUG impl.SessionImpl - after transaction completion
34109 [Finalizer] DEBUG jdbc.ConnectionManager - running Session.finalize()