-->
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: Getting weired Constraint Exception even ir the value exists
PostPosted: Sat Nov 14, 2009 12:51 pm 
Newbie

Joined: Sat Nov 14, 2009 12:16 pm
Posts: 7
Hi All,
I have a issue regarding persisting an object to the DB.. I am persisting an object with cascade-all-delete-orphan..So for example there is a Person table and there are child tables as address.. One person can have may addresses.. So now what i am doing is populating the person object with all the details of child Set available and then updating the person to db. This works fine..the Person table is updated and then the objects in child set are also updated ..when I call saveOrUpdate on the Person.. But now I am getting a weired problem. I am getting Constraint violation exception for one the Address field which is set to as NotNull.. This happens only when I create a new object and add it the set so that it will ne inserted as a new record..
I debuged thru all the steps and found out that all the fields are correctly populated and also the field its throwing this exception for...I debugged it to the end till the saveOrUpdate statement is called..and saw the session object to where it marked that specific object for Insertion.. There to the value exists.. But after that when I call commit it throws the exception..
So now 2 questions..
1. Does any one had the similar problem
2. And is there a way to see the SQL generated by Hibernate with "Values"...

TY


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.