[jboss-user] [EJB 3.0] - How to prepare for EntityManager.refresh()

octaviob do-not-reply at jboss.com
Sat Aug 18 17:13:46 EDT 2007


The following throws an IllegalArgumentException because the location entity is not 'Managed':

Snippet 1:

  |   Location location = workgroup.getLocation();
  |   manager.refresh(location); //throws exception
  |   manager.merge(workgroup);
  | 

My workarround is Snippet 2:

  |   int location id = workgroup.getLocation().getId();
  |   Location location = manager.find(Location.class, id);
  |   workgroup.setLocation(location);
  |   manager.merge(workgroup);
  | 

What did I mis in Snippet 1 to be able to refresh?  

Appreciate your comments,

Octavio
 



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

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



More information about the jboss-user mailing list