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
|
|