]
Strong Liu resolved HHH-6697.
-----------------------------
Resolution: Fixed
Fix Version/s: 4.0.0.next
3.6.8
Assignee: Strong Liu
patch applied, thanks for the pull request.
EntityManager.persist should through EntityExistsException instead of
PersistenceException
------------------------------------------------------------------------------------------
Key: HHH-6697
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6697
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.7
Environment: Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.5.0_22
Java home: C:\Program Files\Java\jdk1.5.0_22\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family:
"windows"
Reporter: Michael Rudolf
Assignee: Strong Liu
Fix For: 3.6.8, 4.0.0.next
The persist method of the {{EntityManager}} interface is not implemented according to the
specification. If handed an already existing entity, it throws an instance of
{{PersistenceException}} instead of {{EntityExistsException}}. The fact that the
exception's cause is an instance of {{DuplicateEntityException}} does not help clients
to determine the reason for the failure in a vendor-independent fashion. Changing this
behavior will most likely not break existing clients, because they often catch instances
of {{PersistenceException}}, which will also catch {{EntityExistsException}} instances.
However, it will enable clients to detect the reason for the failure and thereby allow for
better error reporting to the user. In fact, in case no transaction is running while this
call fails, clients can also recover from the failure and queued actions can be committed
afterwards.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: