Q: I am receiving a hibernate error when i do an update method call and I pass to the method a Java object that i am trying to update in DB2 table.
The java object is "BenefitComponent" and it has collections of other objects. It is mapped using hibernate to a table in DB2, and also its collections are mapped accordingly. The Get() and search methods work, but the update method gives me an error:
Assignment of a NULL value to a NOT NULL column "BNFT_COMP_ID" is not allowed. SQLSTATE=23502.
O Hibernate: update PB1.BNFT_COMP_DTL set BNFT_COMP_ID=null, BC_EFF_FROM_DATE=null where BNFT_COMP_ID=? and BC_EFF_FROM_DATE=?
I outputted the java object i am updating before i call the update method, and i cannot see a BenefitComponent, the business java object, with a null
id or date. I have posted here the hibernate mapping file and also what hibernate generates as a query. From the error stack i see clearly that hibernate is putting null as ID, so this is causing a data-integrity exception since the ID/date cannot be null for this java object.
I would appreciate some help on this issue, since don't know what is causing this. To me looks more like hibernate itself causes the error when it generates its select and update queries internally to do the update.
Thanks,
Hibernate version:
hibernate 3.2.6 version
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/HibernateMapping DTD3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false">
<class name="com.excellus.service.product.holder.BenefitComponentHolder" lazy="true" table="PB1.BNFT_COMP">
<meta attribute="implement-equals">true</meta>
<meta attribute="class-description">Represents the Benefit Component table in the Product ODS v3.0</meta>
<composite-id>
<key-property name="identifier" column="BNFT_COMP_ID" type="int" />
<key-property name="effectiveFromDate" column="BC_EFF_FROM_DATE" type="date" />
</composite-id>
<property name="statusCode" column="STS_CODE" type="string" />
<property name="componentTypeCode" column="COMP_TYPE_CODE" type="string" />
<property name="templateTypeCode" column="TMPLT_TYPE_CODE" type="string" />
<property name="benefitRiderTypeCode" column="BNFT_RDR_TYPE_CODE" type="string" />
<property name="effectiveThroughDate" column="BC_EFF_THRU_DATE" type="date" />
<property name="componentSubTypeCode" column="COMP_SBTP_CODE" type="string" />
<property name="componentTemplateIdentifier" column="COMP_TMPLT_ID" type="int" />
<property name="componentTemplateEffectiveFromDate" column="COMP_TMPLT_EFF_DT" type="date" />
<property name="name" column="NAME_DSCRPTR" type="string" />
<property name="description" column="DESC" type="string" />
<set name="benefitComponentDetails" fetch="select" batch-size="100">
<key>
<column name="BNFT_COMP_ID" not-null="true"/>
<column name="BC_EFF_FROM_DATE" not-null="true"/>
</key>
<one-to-many class="com.excellus.service.product.holder.BenefitComponentDetailHolder"/>
</set>
<set name="benefitComponentLookups" inverse="true" fetch="join" batch-size="10" cascade="all">
<key>
<column name="BNFT_COMP_ID" not-null="true"/>
<column name="BC_EFF_FROM_DATE" not-null="true"/>
</key>
<one-to-many class="com.excellus.service.product.holder.BenefitComponentLookupHolder"/>
</set>
<set name="benefitVariables" inverse="true" fetch="join" batch-size="100" cascade="all">
<key>
<column name="BNFT_COMP_ID" not-null="true"/>
<column name="BC_EFF_FROM_DATE" not-null="true"/>
</key>
<one-to-many class="com.excellus.service.product.holder.BenefitVariableHolder"/>
</set>
</class>
</hibernate-mapping>
------------------------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/HibernateMapping DTD3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="true">
<class name="com.excellus.service.product.holder.BenefitComponentDetailHolder" lazy="true" table="PB1.BNFT_COMP_DTL">
<meta attribute="implement-equals">true</meta>
<meta attribute="class-description">Represents the Benefit Component Detail table in the Product ODS v3.0</meta>
<composite-id>
<key-many-to-one name="benefitComponent" class="com.excellus.service.product.holder.BenefitComponentHolder">
<column name="BNFT_COMP_ID" not-null="true" />
<column name="BC_EFF_FROM_DATE" not-null="true" />
</key-many-to-one>
<key-property name="identifier" column="BNFT_DTL_SQNC_NBR" type="integer"/>
</composite-id>
<property name="benefitCategoryCode" column="BNFT_CAT_CODE" type="string" insert="false" update="false"/>
<property name="benefitDetailCode" column="BNFT_DTL_CODE" type="string" insert="false" update="false"/>
<property name="placeOfServiceCode" column="POS_CODE" type="string" insert="false" update="false"/>
<property name="benefitApplicabilityCode" column="BNFT_APLCBLTY_CD" type="string" />
<property name="benefitApplicabilityNumber" column="BNFT_APLCBLTY_NBR" type="string" />
<property name="benefitLevelCode" column="BNFT_LVL_CODE" type="string"/>
<property name="benefitCoverageTypeCode" column="BNFT_COV_TYPE_CODE" type="string" />
<property name="coverageTypeCode" column="COV_VRBL_TYPE_CODE" type="string" />
<property name="coverageVariableValue" column="COV_VRBL_VLU" type="string" />
<property name="benefitCopayTypeCode" column="BNFT_CPY_TYPE_CODE" type="string" />
<property name="copayTypeCode" column="CPY_VRBL_TYPE_CODE" type="string" />
<property name="copayVariableValue" column="CPY_VRBL_VLU" type="string" />
<property name="benefitCoinsuranceTypeCode" column="BNFT_COINS_TYPE_CD" type="string" />
<property name="coinsuranceTypeCode" column="COINS_VRBL_TYPE_CD" type="string" />
<property name="coinsuranceVariableValue" column="COINS_VRBL_VLU" type="string" />
<property name="benefitCoinsuranceMaxTypeCode" column="BNFT_COINS_MAX_TYP" type="string" />
<property name="coinsuranceMaxTypeCode" column="COINS_MAX_VRBL_TYP" type="string" />
<property name="coinsuranceMaxVariableValue" column="COINS_MAX_VRBL_VLU" type="string" />
<property name="familyCoinsuranceMaxAmount" column="FMLY_COINS_MAX_AMT" type="string" />
<property name="benefitDeductibleTypeCode" column="BNFT_DDCTBL_TYP_CD" type="string" />
<property name="deductibleTypeCode" column="DDCTBL_VRBL_TYP_CD" type="string" />
<property name="deductibleVariableValue" column="DDCTBL_VRBL_VLU" type="string" />
<property name="familyDeductibleAmount" column="FMLY_DDCTBL_AMT" type="string" />
<property name="description" column="DESC" type="string" />
<property name="footNote" column="FOOT_NOTE" type="string" />
<property name="lineOfBusinessCode" column="LOB_CODE" type="string" />
<property name="providerTypeCode" column="PROV_TYPE_CODE" type="string" />
<property name="memberAgeTierCode" column="MBR_AGE_TIER_CODE" type="string" />
<property name="drugTierCode" column="DRUG_TIER_CODE" type="string" />
<property name="visitTierCode" column="VISIT_TIER_CODE" type="string" />
<property name="minMemberAgeNumber" column="MIN_MBR_AGE_NBR" type="integer" />
<property name="maxMemberAgeNumber" column="MAX_MBR_AGE_NBR" type="integer" />
<property name="minVisitNumber" column="MIN_VISIT_NBR" type="integer" />
<property name="maxVisitNumber" column="MAX_VISIT_NBR" type="integer" />
<set name="benefitDetailLimits" inverse="true" lazy="false" fetch="join" batch-size="512" cascade="all" >
<key>
<column name="BNFT_COMP_ID" not-null="true"/>
<column name="BC_EFF_FROM_DATE" not-null="true"/>
<column name="BNFT_DTL_SQNC_NBR" not-null="true"/>
</key>
<one-to-many class="com.excellus.service.product.holder.BenefitComponentDetailLimitHolder"/>
</set>
<many-to-one name="benefitCategoryDetail" class="com.excellus.service.product.holder.BenefitCategoryDetailHolder" property-ref="categoryDetailKey" not-found="ignore" unique="true" fetch="join" lazy="false" update="false">
<column name="BNFT_CAT_CODE" />
<column name="BNFT_DTL_CODE" />
<column name="POS_CODE" />
</many-to-one>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
The Java error/exception that i get in the server console is:
[11/24/08 11:15:07:368 EST] 0000004a SystemOut O [11:15:07,368] DEBUG - [product.holder.BenefitComponentHolder].toString():1114 - Leaving BenefitComponentHolder.toString()
[11/24/08 11:15:07:368 EST] 0000004a SystemOut O [11:15:07,368] DEBUG - [dao.hibernate.BenefitComponentDAOHibernateImpl].update():254 - the BCHolder has: com.excellus.service.product.holder.BenefitComponentHolder@6f73634e[identifier=28140,effectiveFromDate=Tue Jan 01 00:00:00 EST 2008,componentTypeCode=0001,templateTypeCode=0003,statusCode=0008,benefitRiderTypeCode=0000,effectiveThroughDate=Fri Dec 31 00:00:00 EST 9999,componentSubTypeCode=0001,componentTemplateIdentifier=<null>,componentTemplateEffectiveFromDate=<null>,name=BC Basic (w/o Outpt Rider) Monroe Community College Cabinet Members,description=<null>,benefitComponentDetails=[com.excellus.service.product.holder.BenefitComponentDetailHolder@7fc6a35c[benefitComponent=com.excellus.service.product.holder.BenefitComponentHolder@7fc5635c[identifier=28140,effectiveFromDate=Tue Jan 01 00:00:00 EST 2008,componentTypeCode=<null>,templateTypeCode=<null>,statusCode=<null>,benefitRiderTypeCode=<null>,effectiveThroughDate=<null>,componentSubTypeCode=<null>,componentTemplateIdentifier=<null>,componentTemplateEffectiveFromDate=<null>,name=<null>,description=<null>,benefitComponentDetails=<null>,benefitComponentLookups=<null>,benefitComponentLineOfBusinessAvailabilities=<null>,benefitVariables=<null>,providerNetworkCodes=<null>,tierLevelCodes=<null>,benefitVariables=<null>],identifier=2,benefitDetailCode=0093,benefitCategoryCode=0005,placeOfServiceCode=0000,benefitApplicabilityCode=0000,benefitApplicabilityNumber=<null>,benefitLevelCode=0001,benefitCategoryDetail=<null>,benefitDetailLimits=[com.excellus.service.product.holder.BenefitComponentDetailLimitHolder@5673235c[benefitComponentDetail=com.excellus.service.product.holder.BenefitComponentDetailHolder@5674e35c[benefitComponent=com.excellus.service.product.holder.BenefitComponentHolder@567ba35c[identifier=28140,effectiveFromDate=Tue Jan 01 00:00:00 EST 2008,componentTypeCode=<null>,templateTypeCode=<null>,statusCode=<null>,benefitRiderTypeCode=<null>,effectiveThroughDate=<null>,componentSubTypeCode=<null>,componentTemplateIdentifier=<null>,componentTemplateEffectiveFromDate=<null>,name=<null>,description=<null>,benefitComponentDetails=<null>,benefitComponentLookups=<null>,benefitComponentLineOfBusinessAvailabilities=<null>,benefitVariables=<null>,providerNetworkCodes=<null>,tierLevelCodes=<null>,benefitVariables=<null>],identifier=2,benefitDetailCode=<null>,benefitCategoryCode=<null>,placeOfServiceCode=<null>,benefitApplicabilityCode=<null>,benefitApplicabilityNumber=<null>,benefitLevelCode=<null>,benefitCategoryDetail=<null>,benefitDetailLimits=<null>,individualDeductibleBenefitAccumulator=<null>,familyDeductibleBenefitAccumulator=<null>,individualCoinsuranceMaximumBenefitAccumulator=<null>,familyCoinsuranceMaximumBenefitAccumulator=<null>],typeCode=0060,variableTypeCode=<null>,valueTypeCode=0002,timePeriodCode=0002,timePeriodNumber=1,variableValue=60,memberBenefitAccumulator=<null>]],individualDeductibleBenefitAccumulator=<null>,familyDeductibleBenefitAccumulator=<null>,individualCoinsuranceMaximumBenefitAccumulator=<null>,familyCoinsuranceMaximumBenefitAccumulator=<null>], com.excellus.service.product.holder.BenefitComponentDetailHolder@185e6357[benefitComponent=com.excellus.service.product.holder.BenefitComponentHolder@185d2357[identifier=28140,effectiveFromDate=Tue Jan 01 00:00:00 EST 2008,componentTypeCode=<null>,templateTypeCode=<null>,statusCode=<null>,benefitRiderTypeCode=<null>,effectiveThroughDate=<null>,componentSubTypeCode=<null>,componentTemplateIdentifier=<null>,componentTemplateEffectiveFromDate=<null>,name=<null>,description=<null>,benefitComponentDetails=<null>,benefitComponentLookups=<null>,benefitComponentLineOfBusinessAvailabilities=<null>,benefitVariables=<null>,providerNetworkCodes=<null>,tierLevelCodes=<null>,benefitVariables=<null>],identifier=1,benefitDetailCode=0094,benefitCategoryCode=0005,placeOfServiceCode=0000,benefitApplicabilityCode=0000,benefitApplicabilityNumber=<null>,benefitLevelCode=0001,benefitCategoryDetail=<null>,benefitDetailLimits=[com.excellus.service.product.holder.BenefitComponentDetailLimitHolder@16bb2357[benefitComponentDetail=com.excellus.service.product.holder.BenefitComponentDetailHolder@16bce357[benefitComponent=com.excellus.service.product.holder.BenefitComponentHolder@1683a357[identifier=28140,effectiveFromDate=Tue Jan 01 00:00:00 EST 2008,componentTypeCode=<null>,templateTypeCode=<null>,statusCode=<null>,benefitRiderTypeCode=<null>,effectiveThroughDate=<null>,componentSubTypeCode=<null>,componentTemplateIdentifier=<null>,componentTemplateEffectiveFromDate=<null>,name=<null>,description=<null>,benefitComponentDetails=<null>,benefitComponentLookups=<null>,benefitComponentLineOfBusinessAvailabilities=<null>,benefitVariables=<null>,providerNetworkCodes=<null>,tierLevelCodes=<null>,benefitVariables=<null>],identifier=1,benefitDetailCode=<null>,benefitCategoryCode=<null>,placeOfServiceCode=<null>,benefitApplicabilityCode=<null>,benefitApplicabilityNumber=<null>,benefitLevelCode=<null>,benefitCategoryDetail=<null>,benefitDetailLimits=<null>,individualDeductibleBenefitAccumulator=<null>,familyDeductibleBenefitAccumulator=<null>,individualCoinsuranceMaximumBenefitAccumulator=<null>,familyCoinsuranceMaximumBenefitAccumulator=<null>],typeCode=0060,variableTypeCode=<null>,valueTypeCode=0002,timePeriodCode=0002,timePeriodNumber=1,variableValue=60,memberBenefitAccumulator=<null>]],individualDeductibleBenefitAccumulator=<null>,familyDeductibleBenefitAccumulator=<null>,individualCoinsuranceMaximumBenefitAccumulator=<null>,familyCoinsuranceMaximumBenefitAccumulator=<null>]],benefitComponentLookups=[com.excellus.service.product.holder.BenefitComponentLookupHolder@30882348[benefitComponent=com.excellus.service.product.holder.BenefitComponentHolder@308ee348[identifier=28140,effectiveFromDate=Tue Jan 01 00:00:00 EST 2008,componentTypeCode=<null>,templateTypeCode=<null>,statusCode=<null>,benefitRiderTypeCode=<null>,effectiveThroughDate=<null>,componentSubTypeCode=<null>,componentTemplateIdentifier=<null>,componentTemplateEffectiveFromDate=<null>,name=<null>,description=<null>,benefitComponentDetails=<null>,benefitComponentLookups=<null>,benefitComponentLineOfBusinessAvailabilities=<null>,benefitVariables=<null>,providerNetworkCodes=<null>,tierLevelCodes=<null>,benefitVariables=<null>],identifier=1,waiveredCode=<null>,farKeyUnderwritingCorporation=<null>,farKeyLineOfBusiness=<null>,sourceApplicationCode=LR,sourceBenefitComponentIdentifier=99999,sourceBenefitComponentRiderIdentifier=<null>]],benefitComponentLineOfBusinessAvailabilities=<null>,benefitVariables=[com.excellus.service.product.holder.BenefitVariableHolder@10ea634a[benefitComponent=com.excellus.service.product.holder.BenefitComponentHolder@10e9234a[identifier=28140,effectiveFromDate=Tue Jan 01 00:00:00 EST 2008,componentTypeCode=<null>,templateTypeCode=<null>,statusCode=<null>,benefitRiderTypeCode=<null>,effectiveThroughDate=<null>,componentSubTypeCode=<null>,componentTemplateIdentifier=<null>,componentTemplateEffectiveFromDate=<null>,name=<null>,description=<null>,benefitComponentDetails=<null>,benefitComponentLookups=<null>,benefitComponentLineOfBusinessAvailabilities=<null>,benefitVariables=<null>,providerNetworkCodes=<null>,tierLevelCodes=<null>,benefitVariables=<null>],variableTypeCode=0072,variableValue=Y,ratedRangeRuleIndicator=N,rangeRule=<null>,experienceRatedRangeRule=<null>,variableType=<null>]],providerNetworkCodes=<null>,tierLevelCodes=<null>,benefitVariables=[com.excellus.service.product.holder.BenefitVariableHolder@10ea634a[benefitComponent=com.excellus.service.product.holder.BenefitComponentHolder@10e9234a[identifier=28140,effectiveFromDate=Tue Jan 01 00:00:00 EST 2008,componentTypeCode=<null>,templateTypeCode=<null>,statusCode=<null>,benefitRiderTypeCode=<null>,effectiveThroughDate=<null>,componentSubTypeCode=<null>,componentTemplateIdentifier=<null>,componentTemplateEffectiveFromDate=<null>,name=<null>,description=<null>,benefitComponentDetails=<null>,benefitComponentLookups=<null>,benefitComponentLineOfBusinessAvailabilities=<null>,benefitVariables=<null>,providerNetworkCodes=<null>,tierLevelCodes=<null>,benefitVariables=<null>],variableTypeCode=0072,variableValue=Y,ratedRangeRuleIndicator=N,rangeRule=<null>,experienceRatedRangeRule=<null>,variableType=<null>]]]
[11/24/08 11:15:07:446 EST] 0000004a SystemOut O Hibernate: select benefitcom_.BNFT_COMP_ID, benefitcom_.BC_EFF_FROM_DATE, benefitcom_.BNFT_COMP_LKUP_SQN, benefitcom_.WVRD_CODE as WVRD4_3_, benefitcom_.FARKEY_UC as FARKEY5_3_, benefitcom_.FARKEY_LOB as FARKEY6_3_, benefitcom_.SRC_APPL_CODE as SRC7_3_, benefitcom_.SRC_BNFT_COMP_ID as SRC8_3_, benefitcom_.SRC_BNFT_COMPRDRID as SRC9_3_ from PB1.BNFT_COMP_LKUP benefitcom_ where benefitcom_.BNFT_COMP_ID=? and benefitcom_.BC_EFF_FROM_DATE=? and benefitcom_.BNFT_COMP_LKUP_SQN=?
[11/24/08 11:15:07:461 EST] 0000004a SystemOut O Hibernate: select benefitvar_.BNFT_COMP_ID, benefitvar_.BC_EFF_FROM_DATE, benefitvar_.VRBL_TYPE_CODE, benefitvar_.VRBL_VLU as VRBL4_4_, benefitvar_.RTD_RNG_RULE_IND as RTD5_4_, benefitvar_.RNG_RULE as RNG6_4_, benefitvar_.EXPRNC_RTD_RNG_RUL as EXPRNC7_4_ from PB1.BNFT_VRBL benefitvar_ where benefitvar_.BNFT_COMP_ID=? and benefitvar_.BC_EFF_FROM_DATE=? and benefitvar_.VRBL_TYPE_CODE=?
[11/24/08 11:15:07:524 EST] 0000004a SystemOut O Hibernate: update PB1.BNFT_COMP set STS_CODE=?, COMP_TYPE_CODE=?, TMPLT_TYPE_CODE=?, BNFT_RDR_TYPE_CODE=?, BC_EFF_THRU_DATE=?, COMP_SBTP_CODE=?, COMP_TMPLT_ID=?, COMP_TMPLT_EFF_DT=?, NAME_DSCRPTR=?, DESC=? where BNFT_COMP_ID=? and BC_EFF_FROM_DATE=?
[11/24/08 11:15:07:602 EST] 0000004a SystemOut O Hibernate: update PB1.BNFT_COMP_LKUP set WVRD_CODE=?, FARKEY_UC=?, FARKEY_LOB=?, SRC_APPL_CODE=?, SRC_BNFT_COMP_ID=?, SRC_BNFT_COMPRDRID=? where BNFT_COMP_ID=? and BC_EFF_FROM_DATE=? and BNFT_COMP_LKUP_SQN=?
[11/24/08 11:15:07:602 EST] 0000004a SystemOut O Hibernate: update PB1.BNFT_COMP_DTL set BNFT_COMP_ID=null, BC_EFF_FROM_DATE=null where BNFT_COMP_ID=? and BC_EFF_FROM_DATE=?
[11/24/08 11:15:08:055 EST] 0000004a JDBCException W SQL Error: -407, SQLState: 23502
[11/24/08 11:15:08:071 EST] 0000004a JDBCException E [IBM][CLI Driver][DB2] SQL0407N Assignment of a NULL value to a NOT NULL column "BNFT_COMP_ID" is not allowed. SQLSTATE=23502
[11/24/08 11:15:08:165 EST] 0000004a AbstractFlush E Could not synchronize database state with session
[11/24/08 11:15:08:180 EST] 0000004a AbstractFlush E TRAS0014I: The following exception was logged org.hibernate.exception.ConstraintViolationException: could not delete collection: [com.excellus.service.product.holder.BenefitComponentHolder.benefitComponentDetails#component[identifier,effectiveFromDate]{effectiveFromDate=01 January 2008, identifier=28140}]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:1071)
at org.hibernate.action.CollectionRemoveAction.execute(CollectionRemoveAction.java:88)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:169)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:394)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:316)
at org.springframework.orm.hibernate3.HibernateTemplate.update(HibernateTemplate.java:595)
at org.springframework.orm.hibernate3.HibernateTemplate.update(HibernateTemplate.java:591)
at com.excellus.service.product.dao.hibernate.BenefitComponentDAOHibernateImpl.update(BenefitComponentDAOHibernateImpl.java:256)
at com.excellus.service.product.logic.ProductService.processUpdateBenefitComponentRequest(ProductService.java:452)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.excellus.services.Service.processServiceRequest(Service.java:173)
at com.excellus.services.transport.MDBProcessor.onMessage(MDBProcessor.java:193)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:316)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java(Compiled Code))
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:285)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:263)
at com.ibm.mq.jms.MQSession.run(MQSession.java:1691)
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:960)
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:813)
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:614)
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:91)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:127)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:456)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0407N Assignment of a NULL value to a NOT NULL column "BNFT_COMP_ID" is not allowed. SQLSTATE=23502
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(Unknown Source)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteUpdate(WSJdbcPreparedStatement.java:701)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:527)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:1048)
... 39 more
.
org.hibernate.exception.ConstraintViolationException: could not delete collection: [com.excellus.service.product.holder.BenefitComponentHolder.benefitComponentDetails#component[identifier,effectiveFromDate]{effectiveFromDate=01 January 2008, identifier=28140}]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:1071)
at org.hibernate.action.CollectionRemoveAction.execute(CollectionRemoveAction.java:88)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:169)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:394)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:316)
at org.springframework.orm.hibernate3.HibernateTemplate.update(HibernateTemplate.java:595)
at org.springframework.orm.hibernate3.HibernateTemplate.update(HibernateTemplate.java:591)
at com.excellus.service.product.dao.hibernate.BenefitComponentDAOHibernateImpl.update(BenefitComponentDAOHibernateImpl.java:256)
at com.excellus.service.product.logic.ProductService.processUpdateBenefitComponentRequest(ProductService.java:452)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
Name and version of the database you are using:
IBM DB2 version 8
The generated SQL (show_sql=true):
[11/24/08 11:15:07:446 EST] 0000004a SystemOut O Hibernate: select benefitcom_.BNFT_COMP_ID, benefitcom_.BC_EFF_FROM_DATE, benefitcom_.BNFT_COMP_LKUP_SQN, benefitcom_.WVRD_CODE as WVRD4_3_, benefitcom_.FARKEY_UC as FARKEY5_3_, benefitcom_.FARKEY_LOB as FARKEY6_3_, benefitcom_.SRC_APPL_CODE as SRC7_3_, benefitcom_.SRC_BNFT_COMP_ID as SRC8_3_, benefitcom_.SRC_BNFT_COMPRDRID as SRC9_3_ from PB1.BNFT_COMP_LKUP benefitcom_ where benefitcom_.BNFT_COMP_ID=? and benefitcom_.BC_EFF_FROM_DATE=? and benefitcom_.BNFT_COMP_LKUP_SQN=?
[11/24/08 11:15:07:461 EST] 0000004a SystemOut O Hibernate: select benefitvar_.BNFT_COMP_ID, benefitvar_.BC_EFF_FROM_DATE, benefitvar_.VRBL_TYPE_CODE, benefitvar_.VRBL_VLU as VRBL4_4_, benefitvar_.RTD_RNG_RULE_IND as RTD5_4_, benefitvar_.RNG_RULE as RNG6_4_, benefitvar_.EXPRNC_RTD_RNG_RUL as EXPRNC7_4_ from PB1.BNFT_VRBL benefitvar_ where benefitvar_.BNFT_COMP_ID=? and benefitvar_.BC_EFF_FROM_DATE=? and benefitvar_.VRBL_TYPE_CODE=?
[11/24/08 11:15:07:524 EST] 0000004a SystemOut O Hibernate: update PB1.BNFT_COMP set STS_CODE=?, COMP_TYPE_CODE=?, TMPLT_TYPE_CODE=?, BNFT_RDR_TYPE_CODE=?, BC_EFF_THRU_DATE=?, COMP_SBTP_CODE=?, COMP_TMPLT_ID=?, COMP_TMPLT_EFF_DT=?, NAME_DSCRPTR=?, DESC=? where BNFT_COMP_ID=? and BC_EFF_FROM_DATE=?
[11/24/08 11:15:07:602 EST] 0000004a SystemOut O Hibernate: update PB1.BNFT_COMP_LKUP set WVRD_CODE=?, FARKEY_UC=?, FARKEY_LOB=?, SRC_APPL_CODE=?, SRC_BNFT_COMP_ID=?, SRC_BNFT_COMPRDRID=? where BNFT_COMP_ID=? and BC_EFF_FROM_DATE=? and BNFT_COMP_LKUP_SQN=?
[11/24/08 11:15:07:602 EST] 0000004a SystemOut O Hibernate: update PB1.BNFT_COMP_DTL set BNFT_COMP_ID=null, BC_EFF_FROM_DATE=null where BNFT_COMP_ID=? and BC_EFF_FROM_DATE=?
[11/24/08 11:15:08:055 EST] 0000004a JDBCException W SQL Error: -407, SQLState: 23502
[11/24/08 11:15:08:071 EST] 0000004a JDBCException E [IBM][CLI Driver][DB2] SQL0407N Assignment of a NULL value to a NOT NULL column "BNFT_COMP_ID" is not allowed. SQLSTATE=23502
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html