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" >
<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>
First of all is there any wrong with my complex mapping??
when I save session.save(movielibray);
movielibrary object is saved and I expect the childs "movies" also to be saved.But it is actually trying to update the movies and saying "batch update failed"count 0..
I didn't call saveOrUpdate() which I may call sometime later when some childs had to be inserted and some has to be updated.
Any help is greatly appreciated..
Thanks and Regards
|