I have 2 classes:
Code:
<hibernate-mapping package="com.bertrams.berteShop.domain">
<class name="OrderHeader" table="REORDH">
<id name="id" type="long" unsaved-value="0">
<column name="RHORNO" sql-type="long" not-null="true"/>
<generator class="assigned"/>
</id>
<map name="orderItems">
<key column="ODORNO"/>
<index column="ODISBN" type="string"/>
<one-to-many class="OrderItem"/>
</map>
</class>
</hibernate-mapping>
<hibernate-mapping package="com.bertrams.berteShop.domain">
<class name="OrderItem" table="REORDL">
<composite-id name="id" class="OrderItemKey">
<key-property name="number" type="long" column="ODORNO"/>
<key-property name="customer" type="int" column="ODCUST"/>
<key-property name="branch" type="int" column="ODBRCH"/>
<key-property name="consumerId" type="string" column="ODCNSM"/>
<key-property name="isbn" type="string" column="ODISBN"/>
</composite-id>
</class>
</hibernate-mapping>
when i try to save OrderHeader i see 2 sqls:
first: insert into REORDH.....
seconde: update REORDL....
but then there is an exception:
Code:
17:30:22,812 DEBUG BatcherImpl:241 - preparing statement
17:30:22,844 DEBUG LongType:46 - binding '111111' to parameter: 1
17:30:22,844 DEBUG Cascades:331 - id unsaved-value strategy NONE
17:30:22,844 DEBUG LongType:46 - binding '111111' to parameter: 3
17:30:22,844 DEBUG IntegerType:46 - binding '1111111' to parameter: 4
17:30:22,844 DEBUG IntegerType:46 - binding '1' to parameter: 5
17:30:22,906 ERROR SessionImpl:2343 - Could not synchronize database state with session
net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)
Any idea why update sql and not insert to REORDL and why there is exception?