Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

devil devil

Greenhorn
+ Follow
since Feb 13, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by devil devil

u might be using user-defined classes other than defined in api. these classes can be book specific.
include a jar file hibernate3.0
using joins. do it through SQl joins
<class name="Event" table="abc" >
<id name="fid" type="long" unsaved-value="100">
<column name="ID" sql-type="int"/>
<generator class="assigned"/>
</id>

<property name="name"/>

<set name="listValue" cascade="save-update" inverse="true" lazy="false">
<key column="fid" />
<one-to-many class="foreign1"/>
</set>

</class>

<class name="foreign1" table="xyz" >

<id name="id" type="long" unsaved-value="100">
<column name="id" sql-type="int"/>
<generator class="sequence"/>
</id>

<property name="address" type="string" >
<column name="ADDRESS" sql-type="varchar2"/>
</property>

<property name="fid" type="long" >
<column name="fid" sql-type="int"/>
</property>

<many-to-one name="eve" column="fid" class="Event" update="false" insert="false" not-null="true" lazy="proxy"/>

</class>


this is mapping document.

problem i am facing is that
when i execute

Event testEvent = new Event();
java.util.Set forList = new java.util.HashSet();
testEvent.setFid(65);
forList.add(new foreign1("test",1, 65, testEvent));
testEvent.setListValue(forList);
session.save();
tx.commit();
It is genearting two
SQL statements

Hibernate: insert into abc (name, ID) values (?, ?)
Hibernate: update xyz set ADDRESS=?, fid=? where id=?
fid is a foreign key

i want that it should genrate two sql insert statements for both table when it is saving record. but it is not doing so it is trying to update table xyz. please resolve it.