hi,
I am getting the StaleStateException due to inconsistend version values in the tables.
When i commented out the <VERSION> tags, the error disappears.
What is happening is that the child subclasses, TB_VENDOR and TB_BUYER are not incrementing their version numbers in the respective tables while the TB_USER (the parent) is.
The inheritance structure is:
TB_BUYER extends TB_USER
TB_VENDOR extends TB_USER
Question: How can i add a <version> element for the <joined-subclasses> in the mapping file (snippet) show below ?
Thanks for helping.
Tony
Hibernate version: 3.1
Mapping documents:
<class name="TbUser" table="TB_USER"> <id name="id" type="integer" unsaved-value="0"> <column name="ID" /> <generator class="native" /> </id> <!-- <version name="version" column="VERSION" type="integer" unsaved-value="negative"/> --> .......... .......... <joined-subclass name="TbBuyer" table="TB_BUYER" lazy="false"> <key column="id"/> ............ <property name="buyerNameC" type="string"> <column name="BUYER_NAME_C" length="50" /> </property> ............ <set name="tbBids" inverse="true" lazy="false" cascade="all" > <key> <column name="FK2_BID_ID" /> </key> <one-to-many class="TbBid" /> </set> <set name="tbBuyerInvoice" inverse="true" lazy="false" > <key> <column name="FK1_BUYER_INVOICE_ID" /> </key> <one-to-many class="TbBuyerInvoice" /> </set> </joined-subclass> <joined-subclass name="TbVendor" table="TB_VENDOR" lazy="false"> <key column="id"/> <property name="vendorNameC" type="string"> <column name="VENDOR_NAME_C" length="50" /> </property> ....... ........ <set name="tbItems" inverse="true" lazy="false" cascade="all" order-by="LOT_NUM_C asc"> <key> <column name="FK_ITEM_VENDOR_ID" /> </key> <one-to-many class="TbItem" /> </set> <set name="tbVendorInvoice" inverse="true" lazy="false"> <key> <column name="FK1_VENDOR_INVOICE_ID" /> </key> <one-to-many class="TbVendorInvoice" /> </set> </joined-subclass> </class>
Name and version of the database you are using: MYSQL 4.1.10
|