Hello,
I have a serious problem with my Hibernate mappings which where generated by DBVA and am really stuck.
I have a normal relation between an Order, Customer, Customer’s Address and the OrderLines and am not able the save (Update) my Order. Other Objects I can save without a problem.
Now I found out, that when I remove the cascade=“lock” from the mappings it works for some updates but not for others.
This is the Error message:
org.hibernate.HibernateException: Unexpected row count: 0 expected: 1
Do you have any ideas?
Best Regards
Zwitsch
My Order.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<!--
Licensee: Thomas Z
License Type: Purchased
-->
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.wlgore.hbm.Order" table="MSOE_Order" lazy="false">
<id name="OrderId" column="OrderId" type="integer" unsaved-value="0">
<generator class="native">
</generator>
</id>
<property name="season" column="Season" type="string" length="255" not-null="false"/>
<property name="address1" column="Address1" type="string" length="255" not-null="false"/>
...snip... (just other cols like the others)
<property name="customerPo" column="CustomerPo" type="string" length="255" not-null="false"/>
<many-to-one name="Sales" column="SalesId" class="com.wlgore.hbm.Sales">
</many-to-one>
<many-to-one name="ShipTo" column="Shipto" class="com.wlgore.hbm.Address">
</many-to-one>
<many-to-one name="Customer" column="CustomerId" class="com.wlgore.hbm.Customer">
</many-to-one>
<many-to-one name="Status" column="Status" class="com.wlgore.hbm.Status">
</many-to-one>
<set name="Incident" lazy="true" cascade="save-update" inverse="true">
<key column="OrderId" not-null="false"/>
<one-to-many class="com.wlgore.hbm.Incident"/>
</set>
<set name="OrderLine" lazy="true" cascade="save-update" inverse="true">
<key column="OrderId" not-null="true"/>
<one-to-many class="com.wlgore.hbm.OrderLine"/>
</set>
</class>
</hibernate-mapping>