This content has been marked as final.
Show 2 replies
-
1. Re: EntityManager.refresh() works only on managed entities.
wolfgangknauf Nov 23, 2009 7:38 AM (in response to catchsandeepvaid)Hi,
you might better ask this in some EJB spec forum ;-).
The spec/JavaDoc at http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html#refresh%28java.lang.Object%29 explicitely states:... Throws: IllegalArgumentException - if not an entity or entity is not managed ...
To refresh a detached entity, you have to use "find" or "getReference".
Best regards
Wolfgang -
2. Re: EntityManager.refresh() works only on managed entities.
catchsandeepvaid Nov 23, 2009 12:16 PM (in response to catchsandeepvaid)I am just trying to figure out why such a constraint.
Well i personally don;t see any complexity in refreshing entity graph using PK. As the PK is intact in detached instances, we can always load(refresh) the entity graph.