I'm a new user of Hibernate (3.1.3). Used Elver to generate mapping file for an EMF model. Elver tutorial works fine. I then played around a bit. I retrieved a couple of objects in a session and then closed it. Then opened up another session and tried to reattach one of the earlier retrieved objects using update(). The cascading function tries to cascade the update to the other object since it was associated to the first and then fails while trying to insert it (the second object) into the DB since apparently some non-null columns dont have values (ConstraintViolationException).
I havent furnished the whole code, but dont want to confuse the issue - the idea is that when I try to reattach an object that Hibernate just retrieved how can an update possibly give a constraint violation exception? Duplicate I can understand (because it is still there in the DB), but constraint violation?
I'm just trying to understand things here. This piece of code is not important, but I would love a pointer to a place where reattachment etc is explained in detail (the book "Hibernate in Action" and the manual are good, but I havent found the answers there)
I can get more detailed if necessary. Hoping its an RTFM issue - I simply need to know which M and where.
Thanks
Sundeep
|