-->
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: generated="always" not always working
PostPosted: Sun Apr 29, 2007 10:14 am 
Newbie

Joined: Sun Apr 29, 2007 10:05 am
Posts: 1
I have a requirement to have a last updated time and a creation time placed into the db upon insert or update.

I have triggers in the database that manage the update and creation time and I wanted to tell Hibernate to re-read the values after a create/update operation. So I used the generated="always"

This seems to work sometimes. The straightforward case of update of the object I am saving seems to do the right thing, but if the object is updated in another session due to an operation of a parent object then it doesn't seem to work. The SQL generated seems fine but it just doesn't re-read the times into the object.

Example:

Object A has collection of ObjectB.
Object B was saved in another session.

Then we add B to A's collection and that causes B to change ( we set the id of A into B)

When the transaction finishes, A is committed and B is committed and lastupdate time of B is re-read but not into the object !

Any ideas what could cause this problem?


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.