aspose file tools*
The moose likes Object Relational Mapping and the fly likes Adding data using hibernate for Composite primary keys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Adding data using hibernate for Composite primary keys" Watch "Adding data using hibernate for Composite primary keys" New topic
Author

Adding data using hibernate for Composite primary keys

Varun Nayudu
Ranch Hand

Joined: Jun 26, 2006
Posts: 159
Hi guys,

I am having trouble with adding data into the database using hibernate .I have got a table 'ln_user_group' which has 2 columns 'userid,groupname'. Both these fields act as a primary key

The Hibernate mapping file is as follows


I am using netbeansIDE and it automatically generates 2 POJO's of the table 'ln_user_group'

The 2 POJO's a given below..


And the other one is


Now i understand it creates 2 pojo's for generating a unique id , but i want to know how do i add data into this table 'ln_user_group'

My code for adding data into table is as follows:


but i don't thing it will work. Can any one please tell me the write way to add data into this table

SCJP 1.5, SCWCD 1.5
 
 
subject: Adding data using hibernate for Composite primary keys