[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1599?page=all ]
Benoit Goudreault-Emond updated HHH-1599:
-----------------------------------------
Attachment: HHH-1599.patch
The attached patch provides what I believe to be a more robust solution. In general, if
one is extracting the error code from an SQLException obtained through getNextException(),
one should extract the constraint name from that exception's message, not the original
exception's. This has been validated to work on Postgres, but I don't really have
access to the other databases.
I'll attach a patch that modifies only the PostgresDialect (which is the one that
should be applied if you just want to fix that one without risking the other dialects).
ConstraintViolationException returns null with PostgresDialect
(Solution included)
----------------------------------------------------------------------------------
Key: HHH-1599
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1599
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1.3
Environment: Hibernate 3.1.3 , Postgres 8.1.2 (i686), postgresql-8.2dev-501.jdbc.jar
Reporter: Niclas Lindberg
Priority: Minor
Attachments: HHH-1599.patch
Original Estimate: 3 minutes
Remaining: 3 minutes
ConstraintViolationException.getConstraintName() returns null. The problem is that the
message being parsed comes from the SqlException that is the inputparameter to
extractConstraintName(SqlException) in ViolatedConstraintNameExtracter.
Solution. The message provided by sqlException.getMessage() is "batch bla bla
something" but the correct Exception message to parse is
sqlException.getNextException().getMessage()
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira