This is pretty basic stuff. All I am trying to do is insert a Customer.
I am using mysql, tomcat, spring, struts, hibernate.
Using myeclipse I reverseengineered all my tables which created hibernate mapping files, Hibernate Object and DAOs.
When I use findById it works fine, but when I try to insert a customer it fails. Error I get is HibernateOptimisticLockingFailureException (Batch update returned unexpected row count from update: 0 actual row count: 0 exprected: 1″
Customer.hbm.xml
————————
has one id
<id name=”customerId” type=”integer”>
<column name=”CustomerId” />
<generator class=”identity” />
</id>
…
properties
…
<set name=”tktsOrders” inverse=”true”>
<key>
<column name=”CustomerId” not-null=”true” />
</key>
<one-to-many class=”com.dal.hibernate.dbo.Orders” />
</set>
I inserted all values into customer object expect for orders. Hope this information helps you guys to help me.
Please advice me. What am I doing wrong?
Thanks
Tech Lover