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.  [ 2 posts ] 
Author Message
 Post subject: primary key question in joined table
PostPosted: Thu Jan 21, 2010 9:09 am 
Newbie

Joined: Thu Jan 21, 2010 9:02 am
Posts: 2
Hello,

I am trying to figure out how to add primary keys on joined table generated by Hibernate.

So if i add something like this in my parent class:

@OneToMany(cascade=CascadeType.ALL)
@LazyCollection(LazyCollectionOption.FALSE)
@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
@JoinTable(name="ATTRIBUTE_LINK")
private List<Attribute> Attributes;

Hibernate create this ATTRIBUTE_LINK table which link the parent object to one or many attributes in ATTRIBUTES table. However that ATTRIBUTE_LINK table does not have any primary key column. is there a way to insert a primary key in that table also?

thanks

Seb


Top
 Profile  
 
 Post subject: Re: primary key question in joined table
PostPosted: Fri Jan 22, 2010 2:15 am 
Newbie

Joined: Thu Jan 21, 2010 9:02 am
Posts: 2
Any ideas? Maybe my example was not the best one as this kind of joined table is not maybe so needed for a OneToMany relationship, we have also manytomany relationships when the linking table is used there.

Any ideas how to create primary keys in those tables?

thanks!
seb


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.