[hibernate-issues] [Hibernate-JIRA] Resolved: (EJB-350) EJB3 delete problem with detached entities

Emmanuel Bernard (JIRA) noreply at atlassian.com
Sat Apr 5 14:44:33 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bernard resolved EJB-350.
----------------------------------

    Resolution: Rejected

This is the expected operation. You try to delete a non managed object, hence the exception.

> EJB3 delete problem with detached entities
> ------------------------------------------
>
>                 Key: EJB-350
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-350
>             Project: Hibernate Entity Manager
>          Issue Type: Bug
>          Components: EntityManager
>    Affects Versions: 3.3.1.GA
>         Environment: hibernate-3.2.5.ga, hibernate-entitymanager-3.3.1.GA, MS SQL Server, Windows XP Profesisonal
>            Reporter: Balwinder Sodhi
>
> Trying to remove a detached entity fails with the exception given below. Looking into the source code at EJB3DeleteEventListener.java:45 I find that the method (pasted below) *always* throws the exception at line#45 regardless of the event contents.
> 	@Override
> 	protected void performDetachedEntityDeletionCheck(DeleteEvent event) {
> 		EventSource source = event.getSession();
> 		String entityName = event.getEntityName();
> 		EntityPersister persister = source.getEntityPersister( entityName, event.getObject() );
> 		Serializable id =  persister.getIdentifier( event.getObject(), source.getEntityMode() );
> 		entityName = entityName == null ? source.guessEntityName( event.getObject() ) : entityName; 
> 		throw new IllegalArgumentException("Removing a detached instance "+ entityName + "#" + id);
> 	}
> java.lang.IllegalArgumentException: Removing a detached instance com.xxx.em.Edition#282
>         at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventListener.java:45)
>         at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:86)
>         at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:52)
>         at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:766)
>         at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
>         at org.hibernate.ejb.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:246)

-- 
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