[hibernate-issues] [Hibernate-JIRA] Updated: (EJB-349) EM Incorrectly throws EntityExistsException wrapping ConstraintViolationException on constraint violation during delete

Emmanuel Bernard (JIRA) noreply at atlassian.com
Mon Jun 16 10:42:33 EDT 2008


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

Emmanuel Bernard updated EJB-349:
---------------------------------

    Fix Version/s: 3.4.0.CR2

> EM Incorrectly throws EntityExistsException wrapping ConstraintViolationException on constraint violation during delete
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: EJB-349
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-349
>             Project: Hibernate Entity Manager
>          Issue Type: Bug
>          Components: EntityManager
>    Affects Versions: 3.3.1.GA
>         Environment: Postgresql 8.2.7, Hibernate 3.2.4.GA, Hibernate EM 3.3.1.GA
>            Reporter: Derek Chen-Becker
>             Fix For: 3.4.0.CR2
>
>
> When I attempt to delete an entity via a named query, and the entity has a foreign key constraint, the EM throws an EntityExistsException that wraps the real org.hibernate.exception.ConstraintViolationException:
> INFO - Service request (GET) /org/removeEmail.html took 89 Milliseconds
> WARN - SQL Error: 0, SQLState: 23503
> ERROR - ERROR: update or delete on table "organization_email" violates foreign key constraint "fk_org_email" on table "organizations"
>   Detail: Key (id)=(1) is still referenced from table "organizations".
> ERROR - EM Error
> javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationException: could not execute update query
>         at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:605)
>         at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:59)
> I checked the source code for 3.3.1 and revision 14382 of org.hibernate.ejb.AbstractEntityManagerImpl.java has a "FIXME" message on line 612 that basically indicates that this is a known issue. I couldn't find an existing bug on it in JIRA, so I apologize if this is a dup. In any case, is there any way for the EM to determine that the attempted statement was a delete and not an insert/update?

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