I upgraded to 2.1rc1 and ended up getting the following error:
Code:
[java] ERROR [PoolThread-0] (AssertionFailure.java:20) - An AssertionFailure occured - this may indicate a bug in Hibernate
[java] net.sf.hibernate.AssertionFailure: null identifier
[java] at net.sf.hibernate.engine.Key.<init>(Key.java:22)
[java] at net.sf.hibernate.engine.Key.<init>(Key.java:32)
[java] at net.sf.hibernate.impl.SessionImpl.doUpdateMutable(SessionImpl.java:1371)
[java] at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1398)
[java] at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1322)
[java] at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
[java] at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
[java] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:890)
[java] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:815)
[java] at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:738)
[java] at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:715)
My application creates an instance of class RFQ, adds elements to the RFQSupplier and RFQRequisitionItem bags and calls session.save(newRFO). Hibernate 2.1beta6 would persist the object and its collections; 2.1rc1 generates the exception. I used hbm2java to generate the class files. I made no change to the generated java code; the hashCode and equals methods are the ones autogenerated by hbm2java.
I am using java 1.4.2_02-b03, cglib2 and all the .jar files in hibernate-2.1/lib.
Here are the hbm files:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="CPO2">
<class name="com.cgc.esd.pages.cinv.RFQ" table="CPO_RFQ">
<id name="id" column="RFQ_ID" type="java.lang.Long" unsaved-value="null">
<generator class="native">
<param name ="sequence">CPO_RFQ_S</param>
</generator>
</id>
<timestamp name="lastUpdate" column="LAST_UPDATE_DATE"></timestamp>
<property name="inventoryClass" column="INV_CLASS" type="string"/>
<property name="rfqTypeLookup" column="RFQ_TYPE_LKP" type="string"/>
<property name="itemClass" column="ITEM_CLASS" type="string"/>
<property name="rfqCreationDate" column="RFQ_CREATION_DATE" type="timestamp"/>
<property name="shipToLookup" column="SHIP_TO_LKP" type="string"/>
<property name="billToLookup" column="BILL_TO_LKP" type="string"/>
<property name="statusLookup" column="RFQ_STATUS_LKP" type="string"/>
<property name="shipViaLookup" column="SHIP_VIA_LKP" type="string"/>
<property name="replyViaLookup" column="REPLY_VIA_LKP" type="string"/>
<property name="shipmentTermsLookup" column="SHIPMENT_TERMS_LKP" type="string"/>
<property name="dueDate" column="DUE_DATE" type="timestamp"/>
<property name="isFreightIncluded" column="IS_FREIGHT_INCLUDED" type="string"/>
<property name="remarks" column="REMARKS" type="string"/>
<property name="actorId" column="ACTOR_ID" type="java.lang.Long"/>
<property name="userId" column="USER_ID" type="java.lang.Long"/>
<property name="createByUserId" column="CREATED_BY" type="java.lang.Long"/>
<property name="creationDate" column="CREATION_DATE" type="timestamp"/>
<property name="lastUpdatedByUserId" column="LAST_UPDATED_BY" type="java.lang.Long"/>
<bag name="rfqRequisitionItems" table="CPO_RFQ_REQN_ITEMS"
lazy="true" cascade="save-update" inverse="true">
<key column="RFQ_ID"/>
<one-to-many class="com.cgc.esd.pages.cinv.RFQRequisitionItem"/>
</bag>
<bag name="rfqSuppliers" table="CPO_RFQ_SUPPLIERS"
lazy="true" cascade="save-update" inverse="true">
<key column="RFQ_ID"/>
<one-to-many class="com.cgc.esd.pages.cinv.RFQSupplier"/>
</bag>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="CPO2">
<class name="com.cgc.esd.pages.cinv.RFQRequisitionItem" table="CPO_RFQ_REQN_ITEMS">
<id name="id" column="RFQ_REQN_ITEM_ID" type="java.lang.Long" unsaved-value="null">
<generator class="native">
<param name ="sequence">CPO_RFQ_REQN_ITEMS_S</param>
</generator>
</id>
<timestamp name="lastUpdate" column="LAST_UPDATE_DATE"></timestamp>
<property name="weight" column="WGT" type="java.lang.Long"/>
<property name="isWithSample" column="IS_WITH_SAMPLE" type="string"/>
<property name="packingInformation" column="PACKING_INFO" type="string"/>
<property name="resourcesRequired" column="RESOURCES_REQD" type="java.lang.Long"/>
<property name="remarks" column="REMARKS" type="string"/>
<property name="createByUserId" column="CREATED_BY" type="java.lang.Long"/>
<property name="creationDate" column="CREATION_DATE" type="timestamp"/>
<property name="lastUpdatedByUserId" column="LAST_UPDATED_BY" type="java.lang.Long"/>
<!-- many to one with RFQ -->
<many-to-one name="rfq"
class="com.cgc.esd.pages.cinv.RFQ"
column="RFQ_ID" not-null="true"/>
<!-- many to one with requisitionItem -->
<many-to-one name="requisitionItem"
class="com.cgc.esd.pages.cinv.RequisitionItem"
column="REQN_ITEM_ID"/>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="CPO2">
<class name="com.cgc.esd.pages.cinv.RFQSupplier" table="CPO_RFQ_SUPPLIERS">
<id name="id" column="RFQ_SUPL_ID" type="java.lang.Long" unsaved-value="null">
<generator class="native">
<param name ="sequence">CPO_RFQ_SUPPLIERS_S</param>
</generator>
</id>
<timestamp name="lastUpdate" column="LAST_UPDATE_DATE"></timestamp>
<property name="createByUserId" column="CREATED_BY" type="java.lang.Long"/>
<property name="creationDate" column="CREATION_DATE" type="timestamp"/>
<property name="lastUpdatedByUserId" column="LAST_UPDATED_BY" type="java.lang.Long"/>
<!-- many to one with RFQ -->
<many-to-one name="parentRfq"
class="com.cgc.esd.pages.cinv.RFQ"
column="RFQ_ID" not-null="true"/>
<!-- many to one with Supplier -->
<many-to-one name="supplier"
class="com.cgc.esd.pages.cinv.Supplier"
column="SUPL_ID" cascade="none" />
</class>
</hibernate-mapping>