[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-1599) ConstraintViolationException returns null with PostgresDialect (Solution included)

Diego Pires Plentz (JIRA) noreply at atlassian.com
Fri Nov 16 00:32:29 EST 2007


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

Diego Pires Plentz resolved HHH-1599.
-------------------------------------

      Assignee: Diego Pires Plentz
    Resolution: Cannot Reproduce

Just tested against hibernate 3.2.5, postgre 8.2, postgresql-8.2-506.jdbc4.jar

Hibernate: insert into testfoo (test_foo, id) values (?, ?)
03:26:27,171  WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
03:26:27,171 ERROR [JDBCExceptionReporter] Batch entry 0 insert into testfoo (test_foo, id) values (Diego, 2) was aborted.  Call getNextException to see the cause.
03:26:27,171  WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 23505
03:26:27,171 ERROR [JDBCExceptionReporter] ERROR: duplicate key violates unique constraint "test_foo_dup_test"

If you provide a failing test, we can take another look at this. Closing as "Cannot reproduce".


> ConstraintViolationException returns null with PostgresDialect (Solution included)
> ----------------------------------------------------------------------------------
>
>                 Key: HHH-1599
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1599
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1.3
>         Environment: Hibernate 3.1.3 , Postgres 8.1.2 (i686), postgresql-8.2dev-501.jdbc.jar
>            Reporter: Niclas Lindberg
>            Assignee: Diego Pires Plentz
>            Priority: Minor
>         Attachments: HHH-1599-postgres-only.patch, HHH-1599.patch
>
>   Original Estimate: 3 minutes
>  Remaining Estimate: 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list