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: help with exception
PostPosted: Tue Jul 18, 2006 7:03 am 
Beginner
Beginner

Joined: Fri Jul 07, 2006 12:08 pm
Posts: 37
I am getting this exception..

null id in entry (don't flush the Session after an exception occurs)..

when i save an entity(customer),and database rejects it due to violation of some constraint,then when i call to get list of that entitytype(customer)..this exception is raised..

thks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 18, 2006 12:42 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
Quote:
when i save an entity(customer),and database rejects it due to violation of some constraint,then when i call to get list of that entitytype(customer)


you can't do that within the same session. when an exception occurs, you have to abandon the session and start over. so, if you have a situation where a save() fails, then you have to session.Close() and get a new session to do your read.

btw, I've seen (and answered) several of your questions and I have to ask, have you checked the documentation? most of this is described in the doco. also, get your hands on a copy of the Hibernate in Action (for Hibernate 2) book. it has very good details in there, too.

-devon


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 18, 2006 11:16 pm 
Beginner
Beginner

Joined: Fri Jul 07, 2006 12:08 pm
Posts: 37
thks..ya,i hav ordered the book..should get it today..


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.