-->
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.  [ 2 posts ] 
Author Message
 Post subject: @ValueGenerationType applied at insert but not update time
PostPosted: Tue Apr 19, 2016 8:44 am 
Newbie

Joined: Tue Apr 19, 2016 7:38 am
Posts: 1
Hello
I am trying to have an update timestamp generated automatically in-database at every insert/update. I use a custom annotation using @ValueGenerationType as indicated in the in-database section of the Generated Values documentation (http://docs.jboss.org/hibernate/orm/4.3/topical/html/generated/GeneratedValues.html), using
Code:
GenerationTiming.ALWAYS
in my value generation class.
The timestamp field gets correctly filled at object insert time, but does not get updated when I update the object. By logging the generated sql, I can see that current_timestamp is called to fill the field at insert time, but the timestamp field is completely ignored in the update.
I am using a StatelessSession for both the insert and update. If I change my code to use a regular Session, the problem remains the same.
Am I missing something? How can I get my timestamp to update automatically?
Thanks


Top
 Profile  
 
 Post subject: Re: @ValueGenerationType applied at insert but not update time
PostPosted: Tue Apr 19, 2016 9:18 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You can open a Jira issue with a replicating test case. A workaround is to use a DB trigger.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.