[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3814) BatchUpdateException is thrown too late (i.e., when adding unrelated objects) when violating constraints, leading to incorrect stack trace
Daniel Schreiber (JIRA)
noreply at atlassian.com
Mon Mar 16 12:12:41 EDT 2009
BatchUpdateException is thrown too late (i.e., when adding unrelated objects) when violating constraints, leading to incorrect stack trace
------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3814
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3814
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Tested using Hibernate 3.3.1.GA, HSQLDB 1.8.0.7 and also Oracle 9i.
Reporter: Daniel Schreiber
Attachments: hibernate-bug.zip
When adding objects to a stateless session, a BatchUpdateException is thrown when the objects being added violate a UNIQUE constraint. Hower, the exception is thrown "too late": It is NOT thrown when adding an object that violates a constraint, but only when an object of a different type is added.
It seems that Hibernate doesn't check constraints each time an object is added to the session, but only if the type being added changes; I presume this is some kind of optimization. This leads to confusion when debugging, because the statement that causes the exception is not actually the real cause.
I have attached a minimal example demonstrating the issue using HSQLDB. The project can be built using maven.
--
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