-->
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.  [ 3 posts ] 
Author Message
 Post subject: Insert into with composite foreign key
PostPosted: Fri May 16, 2008 8:25 am 
Newbie

Joined: Thu Jun 21, 2007 11:54 pm
Posts: 3
How do i insert into a table which has a foreign key reference of composite key?
For example:
Table A:
A1col varchar(10)
A2col varchar(10)

Both A1col and A2col are primary key

Table B:
B1 col varchar(10)
A1col varchar(10)
A2col varchar(10)

A1col and A2col refer to table A.

How do i insert in table B using hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 16, 2008 12:29 pm 
Newbie

Joined: Thu May 15, 2008 11:58 pm
Posts: 3
Location: La Paz, Bolivia
If you are using Annotations, maybe you can check the explanation of the @IdClass annotation at:
http://www.hibernate.org/hib_docs/annotations/reference/en/html/entity.html#entity-mapping-identifier

Then you should insert by simply assigning values to the properties of the entity bean and persisting it.

_________________
Daniel MurguĂ­a


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 19, 2008 2:21 am 
Newbie

Joined: Thu Jun 21, 2007 11:54 pm
Posts: 3
No ..i am not using annotation.


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

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.