-->
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: No records insert in ManyToMany problem ??
PostPosted: Thu Nov 17, 2005 5:37 am 
Regular
Regular

Joined: Tue Nov 04, 2003 12:37 pm
Posts: 57
Hello,

When I save the Item, it will not update the FUNCTIONITEM_ROLE_LINK table !!!!


Best regards,
Eric


Code:
class Item {

@ManyToMany
   @JoinTable(table = @Table(name = "FUNCTIONITEM_ROLE_LINK"), joinColumns = { @JoinColumn(name = "item_id") }, inverseJoinColumns = { @JoinColumn(name = "role_id") })
   List<Role> roles;



/**
* @param roles
*            The roles to set.
*/
public void setRoles(List<UserRole> roles) {
   this.roles = roles;
}

@Transient
public void addRole(UserRole role) {
   roles.add(role);
}

}







and I add the Item as following :
Code:
Item newItem = new Item();
newItem.setActionPage("#new");
newItem.setLabel("New");
newItem.addRole(UserDelegate.getRole("user"));


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.