-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Noob: getConstraintName() always returning null??
PostPosted: Fri Nov 25, 2005 8:07 pm 
Newbie

Joined: Fri Nov 25, 2005 4:44 pm
Posts: 12
Both new to mysql, and hibernate, and currently trying to implement proper error handling, but..I am unable to determine the name of the column programaticaly generating constraint violtions..any tips greatly apprecaited.

(I'm guessing the problem may in fact be with the sql creating the table??) The sql part of the exception is able to at least find the 'key index' but not the name??


Database: mysql 4.1 (windows)

Table Create SQL (using CLAY eclipse plugin):
CREATE TABLE Borrow.Account (
idAccount BIGINT NOT NULL AUTO_INCREMENT
, date_created DATETIME NOT NULL
, date_lastLogin DATETIME
, firstname VARCHAR(20) NOT NULL
, lastname VARCHAR(20) NOT NULL
, displayname VARCHAR(20) NOT NULL
, password VARCHAR(32)
, neighborhood VARCHAR(64)
, zip INT(10)
, ratingBorrower INT
, ratingLoaner INT
, email VARCHAR(200) NOT NULL
, UNIQUE UQ_Account_idaccount (idAccount)
, UNIQUE UQ_Account_DisplayName (displayname)
, UNIQUE UQ_Account_email (email)
, PRIMARY KEY (idAccount)
)TYPE=InnoDB;

Actual Hibernate Exception Dump (pruned for easy reading):

org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
.....etc..and finally....
Caused by: java.sql.BatchUpdateException: Duplicate entry 'asdf' for key 3
...
...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.