Hi all, I've an appfuse based application...it happened that in advanced testing stage, they proposed a change of requirements such that I've been forced to touch the User class from appfuse in order to manage a ManyToOne association with a class, Group, I developed. in User class I realized the Many side of the relationship
<code> @ManyToOne @JoinTable( name="group_users", joinColumns = { @JoinColumn( name="user_id") }, inverseJoinColumns = @JoinColumn( name="group_id") ) public Group getUserGroup() { return userGroup; } public void setUserGroup(Group userGroup){ this.userGroup = userGroup; } </code> In the One side of the relationship <code> @OneToMany(cascade=CascadeType.ALL) @JoinTable( name="group_users", joinColumns = { @JoinColumn( name="group_id",unique=true) }, inverseJoinColumns = @JoinColumn( name="user_id") ) public Set<User> getUsers() { return users; } /** * @param user the user to set */ public void setUsers(Set<User> users) { this.users = users; } </code> This way Hibernate provides me with three tables two entitities and one associative users_group. Now I can seamlessy insert the user with the belonging group but when I try to update the user I get a NonUniqueObjectException if I use dao.saveOrUpdate(user) and an StaleObjectStateException when I update using, as I read throughout the web, user = dao.merge(user). The unit test, quite obviously, pass... Any pointer?? TIA -- Daniele -- View this message in context: http://n4.nabble.com/NonUniqueObjectException-StaleObjectStateException-again-tp1889008p1889008.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net For additional commands, e-mail: users-h...@appfuse.dev.java.net