hi,
I am using hibernate 2.1 and sybase.this is my scenario
MovieLibrary
=============
ProgramID int
clientID int
composite key is (clientID,ProgramID)
mapping snippet for MovieLibrary is ---
<composite-id
name="movieLibraryPK"
class="MovieLibraryPK" >
<key-property name="clientID" column="clientID"/>
<key-property name="id" column="ProgramID"/>
</composite-id>
<set name="movies" cascade="all" inverse="true">
<key>
<column name="clientID" not-null="true" />
<column name="ProgramID" not-null="true" />
</key>
<one-to-many class="Movie" />
</set>
Movie
========
episodeID int
effectiveStartDate datetime
ProgramID int
clientID int
composite key is (episodeID,effectiveStartDate,clientID,ProgramID)
mapping snippet for Movie is ---
<composite-id
name="moviePK"
class="MoviePK" unsaved-value="any">
<key-property name="id" column="episodeID"/>
<key-property name="effectiveStartDate" column="effectiveStartDate"/>
<key-many-to-one name="movieLibrary" class="MovieLibrary">
<column name="clientID" not-null="true"/>
<column name="ProgramID" not-null="true"/>
</key-many-to-one>
</composite-id>
when I save session.save(movielibray);
movielibrary object along with Movies is saved.when I try to select a record for movielibrary it is trying to fetch the childs,for which query is generated (which is natural).But the problem is after making a select to fetch the childs it is again trying to fetch the parent from them.so the select statements are recursively printed,some kind of strange behaviour.anybody has answer for this.
Any help is greatly appreciated..
Thanks and Regards
|