-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: cannot add entry in table containing composite keys
PostPosted: Wed Dec 30, 2009 6:51 am 
Newbie

Joined: Mon Dec 21, 2009 8:12 am
Posts: 3
Hi Guys,
I am new to Hibernate and i am given some complex instruction to write.
I have one table say(pract) with two columns. Both this columns for composite keys.
One of the key references to 1 table and other references to table 2
i.e prac's one column is in one to many relationship with table 1 and column 2 with table 2

After some research i found out that we cannot generate pojo or corresponding xml for such type of tables like prac.
or atleast eclipse dosent builds it.

I want to insert the value in prac. in both the columns. How can i do it. I can do it for the tables with pojo but i have no clue how can it be done for prac in this case.

below is the sniplet of the xml that references the table prac
MyPlayList.xml entry is below

<set name="songDetailses" inverse="false" lazy="true" table="playlist_details" fetch= "select" >
<key>
<column name="playlist_id" not-null="true" />
</key>
<many-to-many entity-name="com.flotogo.portal.hibernate.domain.SongDetails">
<column name="song_id" not-null="true" />
</many-to-many>
</set>

Song details.xml entry is below
<set name="myPlaylists" inverse="true" lazy="true" table="playlist_details" fetch="select">
<key>
<column name="song_id" not-null="true" />
</key>
<many-to-many entity-name="com.flotogo.portal.hibernate.domain.MyPlaylist">
<column name="playlist_id" not-null="true" />
</many-to-many>
</set>

primary keys in the above tables are playlist_id and song_id
this both keys work as composite key for the table playlist_details
and i want to insert the record in playlist_details

Any help will be highly appreciated;
I want to deliver it as soon as possible and we are not allowed to take help of any colleagues
please help

Thanks in advance
Aavin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.