-
Mar 29th, 2012, 06:51 AM
#1
Merging and object losing OneToMany relations(in view)
I am using Spring MVC 3, JPA and Hibernate.
I have an object A having a list of B. In domain class A I have:
@LazyCollection(LazyCollectionOption.TRUE)
@OneToMany
private List<B> list_Of_B;
When I display A on the view (jsp), everything is fine, I have the list of B.
But then I want to save A and return to the view of A.
Saving is done using an entity manager(in the DAO, called by a service, called by a controller):
@PersistenceContext
EntityManager em;
...
em.merge(A);
In controler, after we save A, we return to the same view of A.
But this time, we lose all the list of B(just on display, the relationship exists in db).
Do I need more annotation on the list of B ?
Thanks in advance.
-
Mar 29th, 2012, 09:47 AM
#2
em
EntityManager.merge loses all the OneToMany
Any work around?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules