Trying to figure out the why an update being called when it is not requested. I am simply doing a load of the Customer class and receive the error enclosed. Certain account numbers work fine, others do not (all w/ simliar data). I am not sure why an update is attempted...I believe the mappings are correct (a single customer can have many totals and many cards) and the load seems pretty simple...
customer = (Customer) getHibernateTemplate().load(Customer.class, accountNumber);
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.loader.Loader] - <total objects hydrated: 7>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <resolving associations for [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@8eae04[cstCode=123 ,csttotKey=BON,csttotPeriode=TR,csttotDate=<null>,csttotValue=0.0,csttotDatupdate=<null>]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <done materializing entity [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@8eae04[cstCode=123 ,csttotKey=BON,csttotPeriode=TR,csttotDate=2003-10-17 14:02:54.653,csttotValue=0.0,csttotDatupdate=2003-10-17 14:02:54.653]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <resolving associations for [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@d964af[cstCode=123 ,csttotKey=COU,csttotPeriode=TR,csttotDate=<null>,csttotValue=0.0,csttotDatupdate=<null>]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <done materializing entity [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@d964af[cstCode=123 ,csttotKey=COU,csttotPeriode=TR,csttotDate=2003-10-17 14:02:54.653,csttotValue=0.0,csttotDatupdate=2003-10-17 14:02:54.653]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <resolving associations for [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@7f8062[cstCode=123 ,csttotKey=CPE,csttotPeriode=TR,csttotDate=<null>,csttotValue=0.0,csttotDatupdate=<null>]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <done materializing entity [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@7f8062[cstCode=123 ,csttotKey=CPE,csttotPeriode=TR,csttotDate=2003-10-17 14:02:54.653,csttotValue=0.0,csttotDatupdate=2003-10-17 14:02:54.653]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <resolving associations for [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@1adb7b8[cstCode=123 ,csttotKey=PME,csttotPeriode=TR,csttotDate=<null>,csttotValue=0.0,csttotDatupdate=<null>]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <done materializing entity [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@1adb7b8[cstCode=123 ,csttotKey=PME,csttotPeriode=TR,csttotDate=2003-10-17 14:02:54.653,csttotValue=0.0,csttotDatupdate=2003-10-17 14:02:54.653]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <resolving associations for [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@3e5a91[cstCode=123 ,csttotKey=PTS,csttotPeriode=TR,csttotDate=<null>,csttotValue=0.0,csttotDatupdate=<null>]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <done materializing entity [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@3e5a91[cstCode=123 ,csttotKey=PTS,csttotPeriode=TR,csttotDate=2003-10-17 14:02:54.653,csttotValue=0.0,csttotDatupdate=2003-10-17 14:02:54.653]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <resolving associations for [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@ee6ad6[cstCode=123 ,csttotKey=RED,csttotPeriode=TR,csttotDate=<null>,csttotValue=0.0,csttotDatupdate=<null>]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <done materializing entity [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@ee6ad6[cstCode=123 ,csttotKey=RED,csttotPeriode=TR,csttotDate=2003-10-17 14:02:54.653,csttotValue=0.0,csttotDatupdate=2003-10-17 14:02:54.653]]>
2004-10-10 22:32:00,921 DEBUG [net.sf.hibernate.impl.SessionImpl] - <resolving associations for [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@15fc672[cstCode=123 ,csttotKey=REM,csttotPeriode=TR,csttotDate=<null>,csttotValue=0.0,csttotDatupdate=<null>]]>
2004-10-10 22:32:00,937 DEBUG [net.sf.hibernate.impl.SessionImpl] - <done materializing entity [com.xyz.model.busobj.CustomerTotals#com.xyz.model.busobj.CustomerTotals@15fc672[cstCode=123 ,csttotKey=REM,csttotPeriode=TR,csttotDate=2003-10-17 14:02:54.653,csttotValue=0.0,csttotDatupdate=2003-10-17 14:02:54.653]]>
2004-10-10 22:32:00,937 DEBUG [net.sf.hibernate.impl.SessionImpl] - <2 collections were found in result set>
2004-10-10 22:32:00,937 DEBUG [net.sf.hibernate.impl.SessionImpl] - <collection fully initialized: [com.xyz.model.busobj.Customer.customerTotals#123 ]>
2004-10-10 22:32:00,937 DEBUG [net.sf.hibernate.impl.SessionImpl] - <collection fully initialized: [com.xyz.model.busobj.Customer.customerTotals#123]>
2004-10-10 22:32:00,937 DEBUG [net.sf.hibernate.impl.SessionImpl] - <2 collections initialized>
2004-10-10 22:32:00,937 DEBUG [net.sf.hibernate.impl.SessionImpl] - <collection initialized>
2004-10-10 22:32:00,968 DEBUG [org.springframework.orm.hibernate.HibernateTemplate] - <Eagerly flushing Hibernate session>
2004-10-10 22:32:00,968 DEBUG [net.sf.hibernate.impl.SessionImpl] - <flushing session>
2004-10-10 22:32:00,968 DEBUG [net.sf.hibernate.impl.SessionImpl] - <Flushing entities and processing referenced collections>
2004-10-10 22:32:01,156 DEBUG [net.sf.hibernate.impl.SessionImpl] - <Collection found: [com.xyz.model.busobj.Customer.customerTotals#123], was: [com.xyz.model.busobj.Customer.customerTotals#123]>
2004-10-10 22:32:01,156 DEBUG [net.sf.hibernate.impl.SessionImpl] - <Collection found: [com.xyz.model.busobj.Customer.cards#123], was: [com.xyz.model.busobj.Customer.cards#123]>
2004-10-10 22:32:01,156 DEBUG [net.sf.hibernate.impl.SessionImpl] - <Processing unreferenced collections>
2004-10-10 22:32:01,156 DEBUG [net.sf.hibernate.impl.SessionImpl] - <Collection dereferenced: [com.xyz.model.busobj.Customer.customerTotals#123 ]>
2004-10-10 22:32:01,156 DEBUG [net.sf.hibernate.impl.SessionImpl] - <Scheduling collection removes/(re)creates/updates>
2004-10-10 22:32:01,296 DEBUG [net.sf.hibernate.impl.SessionImpl] - <Flushed: 0 insertions, 0 updates, 0 deletions to 8 objects>
2004-10-10 22:32:01,296 DEBUG [net.sf.hibernate.impl.SessionImpl] - <Flushed: 0 (re)creations, 0 updates, 1 removals to 3 collections>
2004-10-10 22:32:01,343 DEBUG [net.sf.hibernate.impl.Printer] - <listing entities:>
2004-10-10 22:32:01,343 DEBUG [net.sf.hibernate.impl.Printer] - <com.xyz.model.busobj.CustomerTotals{csttotDatupdate=17 October 2003 14:02:54, csttotValue=0.0, csttotDate=17 October 2003 14:02:54}>
2004-10-10 22:32:01,343 DEBUG [net.sf.hibernate.impl.Printer] - <com.xyz.model.busobj.CustomerTotals{csttotDatupdate=17 October 2003 14:02:54, csttotValue=0.0, csttotDate=17 October 2003 14:02:54}>
2004-10-10 22:32:01,343 DEBUG [net.sf.hibernate.impl.Printer] - <com.xyz.model.busobj.CustomerTotals{csttotDatupdate=17 October 2003 14:02:54, csttotValue=0.0, csttotDate=17 October 2003 14:02:54}>
2004-10-10 22:32:01,343 DEBUG [net.sf.hibernate.impl.Printer] - <com.xyz.model.busobj.CustomerTotals{csttotDatupdate=17 October 2003 14:02:54, csttotValue=0.0, csttotDate=17 October 2003 14:02:54}>
2004-10-10 22:32:01,343 DEBUG [net.sf.hibernate.impl.Printer] - <com.xyz.model.busobj.CustomerTotals{csttotDatupdate=17 October 2003 14:02:54, csttotValue=0.0, csttotDate=17 October 2003 14:02:54}>
2004-10-10 22:32:01,390 DEBUG [net.sf.hibernate.impl.Printer] - <com.xyz.model.busobj.Customer{cstDateupd=17 October 2003 00:00:00, siteCode=00005, cstPhone=01 88 22 43 23 , cstDatexport=null, address=null, cstValidity=01 January 2010 00:00:00, cstDateadd=17 October 2003 00:00:00,
[email protected], cstPhone2=06 23 32 23 67 , customerTotals=[], cstTotpts=600, cards=[], cnilCode=0, cstFax=01 88 22 43 23 , staCode=1, cstCode=123}>
2004-10-10 22:32:01,390 DEBUG [net.sf.hibernate.impl.Printer] - <com.xyz.model.busobj.CustomerTotals{csttotDatupdate=17 October 2003 14:02:54, csttotValue=0.0, csttotDate=17 October 2003 14:02:54}>
2004-10-10 22:32:01,390 DEBUG [net.sf.hibernate.impl.Printer] - <com.xyz.model.busobj.CustomerTotals{csttotDatupdate=17 October 2003 14:02:54, csttotValue=0.0, csttotDate=17 October 2003 14:02:54}>
2004-10-10 22:32:01,390 DEBUG [net.sf.hibernate.impl.SessionImpl] - <executing flush>
2004-10-10 22:32:01,390 DEBUG [net.sf.hibernate.collection.BasicCollectionPersister] - <Deleting collection: [com.xyz.model.busobj.Customer.customerTotals#123 ]>
2004-10-10 22:32:01,390 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <about to open: 0 open PreparedStatements, 0 open ResultSets>
2004-10-10 22:32:01,406 DEBUG [net.sf.hibernate.SQL] - <update CUSTOMER_TOTALS set cst_Code=null where cst_Code=?>
Hibernate: update CUSTOMER_TOTALS set cst_Code=null where cst_Code=?
2004-10-10 22:32:01,406 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <preparing statement>
2004-10-10 22:32:01,406 DEBUG [net.sf.hibernate.type.StringType] - <binding '123 ' to parameter: 1>
2004-10-10 22:32:01,500 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <done closing: 0 open PreparedStatements, 0 open ResultSets>
2004-10-10 22:32:01,500 DEBUG [net.sf.hibernate.impl.BatcherImpl] - <closing statement>
2004-10-10 22:32:01,562 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] - <SQL Exception>
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'CST_CODE', table 'XYZ.dbo.CUSTOMER_TOTALS'; column does not allow nulls. UPDATE fails.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:233)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:500)
at net.sf.hibernate.impl.ScheduledCollectionRemove.execute(ScheduledCollectionRemove.java:22)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2337)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
at org.springframework.orm.hibernate.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:202)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:151)
at org.springframework.orm.hibernate.HibernateTemplate.load(HibernateTemplate.java:196)
at com.xyz.model.dao.hibernate.CustomerDaoHibernateImpl.getCustomer(CustomerDaoHibernateImpl.java:66)
at com.xyz.model.service.impl.CustomerServiceImpl.getCustomer(CustomerServiceImpl.java:54)
at com.xyz.model.dao.hibernate.CustomerDaoHibernateImpl.main(CustomerDaoHibernateImpl.java:87)
2004-10-10 22:32:01,578 WARN [net.sf.hibernate.util.JDBCExceptionReporter] - <SQL Error: 515, SQLState: HY000>
2004-10-10 22:32:01,578 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'CST_CODE', table 'XYZ.dbo.CUSTOMER_TOTALS'; column does not allow nulls. UPDATE fails.>
2004-10-10 22:32:01,578 WARN [net.sf.hibernate.util.JDBCExceptionReporter] - <SQL Error: 3621, SQLState: HY000>
2004-10-10 22:32:01,578 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The statement has been terminated.>
2004-10-10 22:32:01,578 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <could not delete collection: [com.xyz.model.busobj.Customer.customerTotals#123 ]>
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'CST_CODE', table 'XYZ.dbo.CUSTOMER_TOTALS'; column does not allow nulls. UPDATE fails.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:233)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:500)
at net.sf.hibernate.impl.ScheduledCollectionRemove.execute(ScheduledCollectionRemove.java:22)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2337)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
at org.springframework.orm.hibernate.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:202)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:151)
at org.springframework.orm.hibernate.HibernateTemplate.load(HibernateTemplate.java:196)
at com.xyz.model.dao.hibernate.CustomerDaoHibernateImpl.getCustomer(CustomerDaoHibernateImpl.java:66)
at com.xyz.model.service.impl.CustomerServiceImpl.getCustomer(CustomerServiceImpl.java:54)
at com.xyz.model.dao.hibernate.CustomerDaoHibernateImpl.main(CustomerDaoHibernateImpl.java:87)
2004-10-10 22:32:01,578 ERROR [net.sf.hibernate.impl.SessionImpl] - <Could not synchronize database state with session>
net.sf.hibernate.JDBCException: could not delete collection: [com.xyz.model.busobj.Customer.customerTotals#123 ]
at net.sf.hibernate.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:510)
at net.sf.hibernate.impl.ScheduledCollectionRemove.execute(ScheduledCollectionRemove.java:22)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2337)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
at org.springframework.orm.hibernate.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:202)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:151)
at org.springframework.orm.hibernate.HibernateTemplate.load(HibernateTemplate.java:196)
at com.xyz.model.dao.hibernate.CustomerDaoHibernateImpl.getCustomer(CustomerDaoHibernateImpl.java:66)
at com.xyz.model.service.impl.CustomerServiceImpl.getCustomer(CustomerServiceImpl.java:54)
at com.xyz.model.dao.hibernate.CustomerDaoHibernateImpl.main(CustomerDaoHibernateImpl.java:87)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'CST_CODE', table 'XYZ.dbo.CUSTOMER_TOTALS'; column does not allow nulls. UPDATE fails.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:233)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:500)
... 10 more