Hi
I've got a problem with Hibernate hanging when performing a batch insert. It does this whenever inserting a cascade, i.e. a List of dependent objects. My mapping files and the debug logs are shown below. The strange thing is that the customer object and all dependent objects *are* actually stored in the database, but execution never gets past the point:
session.save(customer);
even though no exceptions are thrown. The Customer obejct mapping is shown here:
<class name="uk.co.blueyonder.dialup.dao.Customer" table="CMS_ACCOUNTS">
<composite-id name="id" class="uk.co.blueyonder.dialup.dao.CustomerCompositeId">
<key-property name="accountNumber" type="integer" column="Account_Number" />
<key-property name="siteID" type="integer" column="Site_ID" />
</composite-id>
<property name="password" column="Cms_Password" type="string" />
... more properties....
<list name="telephoneAccounts" table="CMS_TELEPHONES" cascade="all">
<key>
<column name="Account_Number" />
<column name="Site_ID" />
</key>
<index column="ID" /> <!-- Oracle sequence -->
<!--<element column="ID" type="long" /> -->
<one-to-many class="uk.co.blueyonder.dialup.dao.TelephoneAccount" />
</list>
</class>
The full log is shown below.
DEBUG - Saving Customer object...
DEBUG - saving [uk.co.blueyonder.dialup.dao.Customer#uk.co.blueyonder.dialup.dao.CustomerCompositeId@b6b2a5[accountNumber=666,siteID=14]]
DEBUG - processing cascades for: uk.co.blueyonder.dialup.dao.Customer
DEBUG - done processing cascades for: uk.co.blueyonder.dialup.dao.Customer
DEBUG - Wrapped collection in role: uk.co.blueyonder.dialup.dao.Customer.telephoneAccounts
DEBUG - running Session.finalize()
DEBUG - running Session.finalize()
DEBUG - processing cascades for: uk.co.blueyonder.dialup.dao.Customer
DEBUG - cascading to collection: uk.co.blueyonder.dialup.dao.Customer.telephoneAccounts
DEBUG - cascading to saveOrUpdate()
DEBUG - unsaved-value strategy NULL
DEBUG - saveOrUpdate() unsaved instance with id: null
DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG - prepared statement get: select telephone_account_seq.nextval from dual
Hibernate: select telephone_account_seq.nextval from dual
DEBUG - preparing statement
DEBUG - Sequence identifier generated: 22
DEBUG - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG - closing statement
DEBUG - saving [uk.co.blueyonder.dialup.dao.TelephoneAccount#22]
DEBUG - cascading to saveOrUpdate()
DEBUG - unsaved-value strategy NULL
DEBUG - saveOrUpdate() unsaved instance with id: null
DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG - prepared statement get: select telephone_account_seq.nextval from dual
Hibernate: select telephone_account_seq.nextval from dual
DEBUG - preparing statement
DEBUG - Sequence identifier generated: 23
DEBUG - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG - closing statement
DEBUG - saving [uk.co.blueyonder.dialup.dao.TelephoneAccount#23]
DEBUG - done processing cascades for: uk.co.blueyonder.dialup.dao.Customer
DEBUG - Flushing Customer object...
DEBUG - flushing session
DEBUG - processing cascades for: uk.co.blueyonder.dialup.dao.Customer
DEBUG - cascading to collection: uk.co.blueyonder.dialup.dao.Customer.telephoneAccounts
DEBUG - cascading to saveOrUpdate()
DEBUG - saveOrUpdate() persistent instance
DEBUG - cascading to saveOrUpdate()
DEBUG - saveOrUpdate() persistent instance
DEBUG - done processing cascades for: uk.co.blueyonder.dialup.dao.Customer
DEBUG - Flushing entities and processing referenced collections
DEBUG - Collection found: [uk.co.blueyonder.dialup.dao.Customer.telephoneAccounts#uk.co.blueyonder.dialup.dao.CustomerCompositeId@b6b2a5[accountNumber=666,siteID=14]], was: [<unreferenced>]
DEBUG - Processing unreferenced collections
DEBUG - Scheduling collection removes/(re)creates/updates
DEBUG - Flushed: 3 insertions, 0 updates, 0 deletions to 3 objects
DEBUG - Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
DEBUG - executing flush
DEBUG - Inserting entity: uk.co.blueyonder.dialup.dao.Customer#uk.co.blueyonder.dialup.dao.CustomerCompositeId@b6b2a5[accountNumber=666,siteID=14]
DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG - prepared statement get: insert into CMS_ACCOUNTS (Cms_Password, Service_Type, Last_Bill_Value, Last_Bill_Date, Previous_Bill_Value, Previous_Bill_Date, Customer_Name, Address_Line_1, Address_Line_2, Address_Line_3, Address_Line_4, Postcode, Account_Number, Site_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into CMS_ACCOUNTS (Cms_Password, Service_Type, Last_Bill_Value, Last_Bill_Date, Previous_Bill_Value, Previous_Bill_Date, Customer_Name, Address_Line_1, Address_Line_2, Address_Line_3, Address_Line_4, Postcode, Account_Number, Site_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
DEBUG - preparing statement
DEBUG - Dehydrating entity: uk.co.blueyonder.dialup.dao.Customer#uk.co.blueyonder.dialup.dao.CustomerCompositeId@b6b2a5[accountNumber=666,siteID=14]
DEBUG - binding 'foo' to parameter: 1
DEBUG - binding 'B' to parameter: 2
DEBUG - binding '100.0' to parameter: 3
DEBUG - binding '03 September 2003' to parameter: 4
DEBUG - binding '200.0' to parameter: 5
DEBUG - binding '03 September 2003' to parameter: 6
DEBUG - binding 'Rory Winston' to parameter: 7
DEBUG - binding 'Address1' to parameter: 8
DEBUG - binding 'Address2' to parameter: 9
DEBUG - binding 'Address3' to parameter: 10
DEBUG - binding 'Address4' to parameter: 11
DEBUG - binding 'sw4 123' to parameter: 12
DEBUG - binding '666' to parameter: 13
DEBUG - binding '14' to parameter: 14
DEBUG - Adding to batch
DEBUG - Inserting entity: uk.co.blueyonder.dialup.dao.TelephoneAccount#22
DEBUG - Executing batch size: 1
DEBUG - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG - closing statement
DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG - prepared statement get: insert into CMS_TELEPHONES (Account_Number, Site_ID, Unformatted_Telephone_Number, Formatted_Telephone_Number, ID) values (?, ?, ?, ?, ?)
Hibernate: insert into CMS_TELEPHONES (Account_Number, Site_ID, Unformatted_Telephone_Number, Formatted_Telephone_Number, ID) values (?, ?, ?, ?, ?)
DEBUG - preparing statement
DEBUG - Dehydrating entity: uk.co.blueyonder.dialup.dao.TelephoneAccount#22
DEBUG - binding '666' to parameter: 1
DEBUG - binding '14' to parameter: 2
DEBUG - binding '123' to parameter: 3
DEBUG - binding '123-456-789' to parameter: 4
DEBUG - binding '22' to parameter: 5
DEBUG - Adding to batch
DEBUG - Inserting entity: uk.co.blueyonder.dialup.dao.TelephoneAccount#23
DEBUG - Dehydrating entity: uk.co.blueyonder.dialup.dao.TelephoneAccount#23
DEBUG - binding '666' to parameter: 1
DEBUG - binding '14' to parameter: 2
DEBUG - binding '456' to parameter: 3
DEBUG - binding '123-456-789' to parameter: 4
DEBUG - binding '23' to parameter: 5
DEBUG - Adding to batch
DEBUG - Executing batch size: 2
DEBUG - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG - closing statement
DEBUG - Inserting collection: uk.co.blueyonder.dialup.dao.Customer.telephoneAccounts#uk.co.blueyonder.dialup.dao.CustomerCompositeId@b6b2a5[accountNumber=666,siteID=14]
DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG - prepared statement get: update CMS_TELEPHONES set Account_Number=?, Site_ID=?, ID=? where ID=?
Hibernate: update CMS_TELEPHONES set Account_Number=?, Site_ID=?, ID=? where ID=?
DEBUG - preparing statement
DEBUG - binding '666' to parameter: 1
DEBUG - binding '14' to parameter: 2
DEBUG - binding '22' to parameter: 4
DEBUG - binding '0' to parameter: 3
DEBUG - Adding to batch
DEBUG - binding '666' to parameter: 1
DEBUG - binding '14' to parameter: 2
DEBUG - binding '23' to parameter: 4
DEBUG - binding '1' to parameter: 3
DEBUG - Adding to batch
DEBUG - done inserting collection
DEBUG - Executing batch size: 2
|