[jboss-user] [JBoss Seam] - Re: Changes not persisted using EntityHome

waynebagguley do-not-reply at jboss.com
Mon Apr 9 16:32:33 EDT 2007


I've got a one-to-many relationship in one of my beans and have never had any trouble. This is from my entity bean:

List<Request> requests = new ArrayList<Request>();
  | 
  | @OneToMany
  |     public List<Request> getRequests()
  |     {
  |         return requests;
  |     }
  |     public void setRequests(List<Request> requests)
  |     {
  |         this.requests = requests;
  |     }

If you are having to perform a merge() then that's because you are not using a seam managed persistence context.

I am using an injected persistence context in my session bean:
@In
  | EntityManager entityManager

This is then configured in components.xml and persistence.xml.

I'm still experimenting with the 1-many relationship in terms of how changes are persisted when items are added and removed, I can get it to work quite easily but I'm sure there's a better way than the one I'm using.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035806#4035806

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035806



More information about the jboss-user mailing list