-------------------------------------------------------------------------------------------------------------- PricingPlanHistory.hbm.xml
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > <hibernate-mapping package="com.ppt.domain" schema="ATADB"> <class name="PricingPlanHistory" table="PRICING_PLAN_LOG"> <id name="logId" type="long" column="PRICING_PLAN_LOG_ID" > <generator class="identity"/> </id> <property name="pricingPlan" type="string" column="PRICING_PLAN" length="255" /> <property name="updatedDate" column="UPDATED_DT" type="timestamp" /> <many-to-one name="pricingPlanParent" class="PricingPlan" insert="false" update="false" lazy="false"> <column name="PRICING_PLAN" not-null="true" /> </many-to-one> <set name="pricingPlanDetailsHistory" table="PRICING_PLAN_DETAILS_LOG" inverse="true" lazy="true" fetch="join" cascade="save-update"> <key> <column name="PRICING_PLAN_LOG_ID" not-null="true" /> </key> <one-to-many class="PricingPlanDetailsHistory" /> </set> <property name="planDescription" column="PRICING_PLAN_DESC" type="string" length="255" /> <property name="action" column="ACTION" type="string" length="255" /> <property name="updatedBy" column="UPDATED_BY" type="string" length="10" /> <property name="comments" column="COMMENTS" type="string" length="255" /> </class> <query name="select.pricingplan.history"> from PricingPlanHistory where pricingPlan=:plan order by updatedDate </query> <query name="select.pricingplan.comments"> from PricingPlanHistory where pricingPlan=:plan and updatedBy=:by and updatedDate=:date </query> </hibernate-mapping>
----------------------------------------------------------------------------------------------------------- POJO: private Long logId; private String pricingPlan; private String planDescription; private String action; private Date updatedDate; private String updatedBy; private String comments; private PricingPlan pricingPlanParent;
private Set<PricingPlanDetailsHistory> pricingPlanDetailsHistory = new HashSet<PricingPlanDetailsHistory>(0);
----------------------------------------------------------------------------------------------------------- PricingPlanDetailsHistory.hbm.xml
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > <hibernate-mapping package="com.ppt.domain" schema="ATADB"> <class name="PricingPlanDetailsHistory" table="PRICING_PLAN_DETAILS_LOG"> <id name="logId" type="long" column="LOG_ID" > <generator class="identity"/> </id> <many-to-one name="pricingPlanHistoryParent" class="PricingPlanHistory" insert="false" update="false" lazy="false" > <column name="PRICING_PLAN_LOG_ID" not-null="true" /> </many-to-one> <property name="productType" type="string" column="PRODUCT_TYPE" length="50" /> <property name="priceFactor" column="PRICE_FACTOR" type="java.math.BigDecimal" /> <property name="displayOrder" column="DISPLAY_ORDER" type="integer" /> </class> </hibernate-mapping>
----------------------------------------------------------------------------------------------------- POJO:
private Long logId; private String productType; private BigDecimal priceFactor; private Integer displayOrder; private PricingPlanHistory pricingPlanHistoryParent;
----------------------------------------------------------------------------------------------------
When saveorupdate is called, i get the following exception. Looks like its trying to insert null into PRICING_PLAN_LOG_ID.
Exception:
[8/10/11 20:39:25:340 EDT] 0000003e SystemOut O Hibernate: insert into PRICING_PLAN_LOG (PRICING_PLAN, UPDATED_DT, PRICING_PLAN_DESC, ACTION, UPDATED_BY, COMMENTS, PRICING_PLAN_LOG_ID) values (?, ?, ?, ?, ?, ?, default) [8/10/11 20:39:25:387 EDT] 0000003e SystemOut O Hibernate: insert into PRICING_PLAN_DETAILS_LOG (PRODUCT_TYPE, PRICE_FACTOR, DISPLAY_ORDER, LOG_ID) values (?, ?, ?, default) [8/10/11 20:39:25:434 EDT] 0000003e JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: -407, SQLState: 23502 [8/10/11 20:39:25:481 EDT] 0000003e JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=15, COLNO=1" is not allowed.. SQLCODE=-407, SQLSTATE=23502, DRIVER=3.50.152 [8/10/11 20:39:28:091 EDT] 0000003e ProcessPricin E logError Exception in EPLRequestCommand org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.ppt.domain.PricingPlanDetailsHistory]; SQL [insert into PRICING_PLAN_DETAILS_LOG (PRODUCT_TYPE, PRICE_FACTOR, DISPLAY_ORDER, LOG_ID) values (?, ?, ?, default)]; Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=15, COLNO=1" is not allowed.. SQLCODE=-407, SQLSTATE=23502, DRIVER=3.50.152; nested exception is com.ibm.db2.jcc.b.lm: Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=15, COLNO=1" is not allowed.. SQLCODE=-407, SQLSTATE=23502, DRIVER=3.50.152 com.ibm.db2.jcc.b.lm: Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=15, COLNO=1" is not allowed.. SQLCODE=-407, SQLSTATE=23502, DRIVER=3.50.152 at com.ibm.db2.jcc.b.wc.a(wc.java:575) at com.ibm.db2.jcc.b.wc.a(wc.java:57) at com.ibm.db2.jcc.b.wc.a(wc.java:126) at com.ibm.db2.jcc.b.tk.c(tk.java:1901) at com.ibm.db2.jcc.b.tk.a(tk.java:1443) at com.ibm.db2.jcc.t4.db.n(db.java:739)
Has anybody else encountered such an issue. Any help is much appretiated. Thanks
|