-->
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: MAny to Many relationships using annotations with more field
PostPosted: Fri Oct 01, 2010 11:11 am 
Newbie

Joined: Fri Oct 01, 2010 10:49 am
Posts: 2
My table structure is like this:

USERS -> user_id , user_nm
GROUP_MAP -> user_id, group_id , perm_id(this field is assign permission for user_id and grou_id combination)
GROUPS -> group_id , group_nm

The asscociation in my USERS.JAVA POJO is

@ManyToMany(cascade = CascadeType.ALL)
@ForeignKey(name = "FK_USER_ID", inverseName = "FK_GROUP_ID")
@JoinTable(name = "GROUP_MAP", joinColumns = {@JoinColumn(name = "USER_ID")},
inverseJoinColumns = {@JoinColumn(name = "GROUP_ID")})
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}

How do I insert values into the perm_id column when I insert groups.
Thanks for help


Top
 Profile  
 
 Post subject: Re: MAny to Many relationships using annotations with more field
PostPosted: Mon Oct 18, 2010 5:19 pm 
Newbie

Joined: Fri Oct 01, 2010 10:49 am
Posts: 2
the above problem was solved using the following guidelines

http://boris.kirzner.info/blog/archives ... osite-key/

. Thanks


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.