[hibernate-issues] [Hibernate-JIRA] Resolved: (EJB-273) refresh() throws entity not managed exception
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Fri Mar 9 18:47:09 EST 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-273?page=all ]
Emmanuel Bernard resolved EJB-273:
----------------------------------
Resolution: Won't Fix
Sorry the spec mandate that.
> refresh() throws entity not managed exception
> ---------------------------------------------
>
> Key: EJB-273
> URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-273
> Project: Hibernate Entity Manager
> Type: Bug
> Components: EntityManager
> Versions: 3.2.1
> Reporter: Charles Canning
> Priority: Critical
>
>
> When you call EntityManager.refresh() to reattach an entity to the entitymanager, it throws:
> java.lang.IllegalArgumentException: Entity not managed
> at org.hibernate.ejb.AbstractEntityManagerImpl.refresh(AbstractEntityManagerImpl.java:260)
> The code is:
> public void refresh(Object entity) {
> checkTransactionNeeded();
> //adjustFlushMode();
> try {
> if ( ! getSession().contains( entity ) ) {
> throw new IllegalArgumentException( "Entity not managed" );
> }
> getSession().refresh( entity );
> }
> catch (MappingException e) {
> throw new IllegalArgumentException( e.getMessage(), e );
> }
> catch (HibernateException he) {
> throwPersistenceException( he );
> }
> }
> It is checking if the object is already in the session - this will not allow me to reattach. If I "cast" the EM to the session delegate, refresh works fine because it doesn't contain this check.
> For more info, you can look at this forum topic :
> http://forum.hibernate.org/viewtopic.php?t=971661&start=0&postdays=0&postorder=asc&highlight=
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list