It sounds like Spring is not properly mapping DB2Exception to
DataIntegrityViolationException. What happens if you change it to
catch DataAccessException - does it pass then?

Matt

On 5/30/07, Ding, Qin <[EMAIL PROTECTED]> wrote:




Matt:



I am running appfuse 1.9.4 with JSF and DB2.  I found an article you posted
regarding appfuse with DB2 issue and how to fix them.  I came cross the same
error but not with the "testAddUserRole()".  It is the "testUpdateUser()"
method throwing the following error.

  [junit] Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI
Driver][DB2/NT] SQL0803N  One or mor
e values in the INSERT statement, UPDATE statement, or foreign key update
caused by a DELETE stateme
nt are not valid because the primary key, unique constraint or unique index
identified by "1" constr
ains table "ADMIN.USER_ROLE" from having duplicate rows for those columns.
SQLSTATE=23505




If I comment out the following line from "testUpdateUser()", the test goes
well. How can I fix this problem?  Thank you.



user.setId(null);

        endTransaction();

        try {

            dao.saveUser(user);

            //fail("saveUser didn't throw
DataIntegrityViolationException");

        } catch (DataIntegrityViolationException e) {

            assertNotNull(e);

            log.debug("expected exception: " + e.getMessage());

        }


--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to