- This topic has 5 replies, 2 voices, and was last updated 14 years, 10 months ago by DIS.
-
AuthorPosts
-
DISMemberI have a small test application built that uses link tables for one to many relationship. The User object can have many roles so jpa builds the following:
private Set<UserApplicationrole> userApplicationroles = new HashSet<UserApplicationrole>(0);
When run, the application User objects appear to have this ‘set’ populated correctly. The problem comes when I try to change the users role. Say the initial role is guest and the new role is admin. I remove the guest UserApplicationrole from the above ‘set’ and add a admin UserApplicationrole to the userApplicationroles ‘set’. When I update using
EntityManagerHelper.beginTransaction(); updatedUser = new UserDAO().update(user); EntityManagerHelper.commit();
The db has the new admin role but the old guest role was not removed. Remember I removed the guest role from the userApplicationroles set. I must be missing something basic but can’t figure out what it is.
This behavior is the same with toplink and hibernate. I have other issues with hibernate. I think it is a pilot error but don’t know for sure. Is there a sample app that uses link table for one to many that might show me the way IF my mistake is not obvious.
Any help is appreciated.
I’m running…
fedora: 2.6.27.21-78.2.41.fc9.i686
MyEclipse Version: 8.0M2 installed using pulse
DISMemberI can identify the deleted role(s) and call
new UserApplicationroleDAO().delete(userApprole);
myself. I just thought these orm tools would do this for me. I wrote the code to to this and it is working. Anyone know if this is the way it should be done?
support-shaliniMemberDIS,
Can you share your project with us. You can send a mail to support@genuitec.com and attach your project. Please add ATTN:Shalini in the subject and refer to this post.
Also, send us the scripts of the tables you are using.
DISMemberShalini,
Just wanted to let you know I sent the project. Let me know if you need anything else.
Thanks
Chuck
support-shaliniMemberChuck,
I have received you files
I shall get back to you soon
DISMemberThis message has not been recovered.
-
AuthorPosts