db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhinav Gupta (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6773) Derby throws plain SQLIntegrityConstraintViolationException
Date Wed, 04 Mar 2015 07:25:05 GMT

    [ https://issues.apache.org/jira/browse/DERBY-6773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14346527#comment-14346527
] 

Abhinav Gupta commented on DERBY-6773:
--------------------------------------

Hi Bryan,

Before writing the new exception class, I wanted to refer the code of the
SQLIntegrityConstraintViolationException.java, and understand how it works
but when I go through the java file, I just see the declaration of the
constructors.

Moreover the current error that the
SQLIntegrityConstraintViolationException gives is
"java.sql.SQLIntegrityConstraintViolationException: The statement was
aborted bec
ause it would have caused a duplicate key value in a unique or primary key
const
raint or unique index identified by 'UK_APPLICATION_NAME' defined on
'APPLICATIO
N'."

Should this be the desired output of the new class ?
"java.sql.DerbySQLIntegrityConstraintViolationException: The statement was
aborted bec
ause it would have caused a duplicate key value in a unique index
identified by
'UK_APPLICATION_NAME' defined on 'APPLICATION' and a duplicate key value
in a primary key userId defined on APPLICATION. "

And if I have to add a new java file to the derby code and test it, what is
the procedure ? I saved a new jave file in the desired directory of the
source code and then built the code again with the command ant build all,
but the built fails giving an error that it can't find the label (name of
the new java class). Do I have to edit the build.xml as well ?




On Tue, Mar 3, 2015 at 4:11 AM, Bryan Pendleton (JIRA) <jira@apache.org>



> Derby throws plain SQLIntegrityConstraintViolationException
> -----------------------------------------------------------
>
>                 Key: DERBY-6773
>                 URL: https://issues.apache.org/jira/browse/DERBY-6773
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.10.2.0
>         Environment: Windows 7 x86_64, Java 1.6.0.45
>            Reporter: Jochen Wiedmann
>            Assignee: Abhinav Gupta
>            Priority: Minor
>         Attachments: DERBY6733Repro.java
>
>
> If a unique constraint is violated by an insert statement, then Derby throws an SQLIntegrityConstraintViolationException.
The error message contains, in particular, the constraint name and the table name.
> To distinguish between cases with various constraints, Derby should instead throw a subclass
of SQLIntegrityConstraintViolationException, with methods like getConstraintName(), and getTableName().
> See also https://hibernate.atlassian.net/browse/HHH-9516.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message