I am using hibernate 3.5.0 final with spring.In this I want to save data to a table which has a composite key associated from three other tables.I have used hibernateTemplate.save().But when I see the logs it clearly shows that there is a select happening before every insert.I am not able to identify the reason still.
Please help!
Mapping:
<hibernate-mapping>
<class name="class1" table="EVENT_ASSET_DISPOSITION">
<composite-id name="id" class="Idclass">
<key-property name="pk1" type="java.math.BigInteger">
<column name="PK_1" precision="38" scale="0" not-null="true"/>
</key-property>
<key-property name="pk2" type="long">
<column name="PK_2" not-null="true" />
</key-property>
<key-property name="pk3" type="long">
<column name="PK_3" precision="38" scale="0" not-null="true"/>
</key-property>
</composite-id>
<property name="column1" type="java.math.BigDecimal" generated="insert">
<column name="COLUMN_1" precision="38" scale="0" />
</property>
</hibernate-mapping>
SQL:-
[STDOUT] (pool-14-thread-1) insert into TABLE_1 (COLUMN_1,PK_1,PK_2,PK_3) values (?, ?, ?, ?,) 2011-02-14 08:28:30,312 INFO [STDOUT] (pool-14-thread-1) Hibernate: select table1_.COLUMN_1 as COLUMN1_280_ from TABLE_1 as table1_ where table1_.PK_1=? and table1_.PK_2=? and table1_.PK_3=?
Cheers, Dwarak