Mar 29th, 2012, 06:51 AM
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:
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):
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
EntityManager.merge loses all the OneToMany
Any work around?