-->
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.  [ 2 posts ] 
Author Message
 Post subject: discriminating between DataIntegrityViolationException
PostPosted: Wed Sep 29, 2004 10:15 am 
Newbie

Joined: Wed Sep 29, 2004 9:53 am
Posts: 1
I am using Spring with Hibernate to persist User entities. Users have roles and attributes. The Users table has many-to-many relationships with the Roles table and with the Attributes table. There are several cases in which I get a DataIntegrityViolationException while saving a User:
- when trying to persist a User with an already existing userName (violation of UNIQUE constraint)
- when trying to persist a User with a Role that has been deleted (in the meantime) (violation of FOREIGN KEY constraint)
- when trying to persist a User with an Attribute that has been deleted (in the meantime) (violation of FOREIGN KEY constraint)
I would like to know if there is a way to discriminate between these exceptions, in order to be able to display an appropriate message. My application has to support multiple databases (Oracle, MSSqlServer). Parsing the exception messages is not an option.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 8:13 am 
Regular
Regular

Joined: Mon Mar 06, 2006 6:18 am
Posts: 95
Location: Bern, Switzerland
hello

did you solve the problem? I also get this Exception when inserting a user with an assigned role.

I have three tables, TBENUTZER (with users), TPROFILE (with roles) and a mapping table TBENU_TPROFIL_MATRIX. The benutzer and profile also have a many-to-many relationship

Angela


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

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.