-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to manage errors with a save()
PostPosted: Fri Sep 22, 2006 1:28 pm 
Beginner
Beginner

Joined: Tue Sep 19, 2006 1:48 pm
Posts: 20
I am a begineer with Hibernate.
When using the save() method on a session and saving a duplicate entry in my database (same ID), I get an error. That's normal! Thow I would like to catch this particular error. How can I know, from the HibernateException thrown, that the problem is an integrity problem and not something else?

Hibernate version: 3.1.3


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 23, 2006 9:30 am 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
well your exception must ba an instance of org.hibernate.exception.ConstraintViolationException.
--------------------
don't forget to credit

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 23, 2006 2:27 pm 
Beginner
Beginner

Joined: Tue Sep 19, 2006 1:48 pm
Posts: 20
thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.