Hello everybody,
I've got a table with two foreign keys composite id.
i want to insert or update rows in this table. I'm using the next mapping with hibernate 3.0
Code:
<class name="ClassA" table="cv_axb">
<composite-id>
<key-many-to-one name="b" class="ClassB">
<column name="b" not-null="true"></column>
</key-many-to-one>
<key-many-to-one name="c" class="ClassC">
<column name="c" not-null="true"></column>
</key-many-to-one>
</composite-id>
<property name="otherProperty" type="java.lang.Integer">
<column name="otherProperty"/>
</property>
</class>
When I try to insert new rows, I set in "b" and "c" attributes not-null values, but "merge()" method automatically launches a select query before insert:
Code:
select
cv_axb0_.b as b_1_4_0_,
cv_axb0_.c as c_4_0_,
cv_axb0_.otherProperty as otherPro3_4_0_
from
cv_axb cv_axb0_
where
cv_axb0_.c=?
and cv_axb0_.b=?
Here it sets b and c to null and then,
Code:
insert
into
cv_axb
(d, c, b)
values
(?, ?, ?)
I got a "Could not execute JDBC batch update" Error cause b and c are not nullable, and I don't know how to do it.
I've tried
Code:
select-before-update = "false"
but it doesn't work.
Thnx to all!