-->
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: <version> tag and generated="always"
PostPosted: Tue Nov 02, 2010 5:52 pm 
Newbie

Joined: Wed Oct 13, 2010 11:19 am
Posts: 7
Looks like this is updating the timestamp value before it does the update

hibernate.cfg.xml:

Code:
<version name="civUpdateDt" column="CIV_UPDATE_DT" type="dbtimestamp"
           generated="always" />


Nov 2, 2010 5:27:20 PM org.hibernate.engine.Versioning increment
FINEST: Incrementing: Tue Nov 02 16:42:16 EDT 2010 to 2010-11-02 17:27:20.234248

FINE: update EID.CIVILIANS set CIV_UPDATE_BY = 'JOHN', CIV_FNAME=?, CIV_LNAME=? where CIV_ID=? and CIV_UPDATE_DT=?
Hibernate: update EID.CIVILIANS set CIV_UPDATE_BY = 'JOHN', CIV_FNAME=?, CIV_LNAME=? where CIV_ID=? and CIV_UPDATE_DT=?
Nov 2, 2010 5:27:20 PM org.hibernate.jdbc.AbstractBatcher getPreparedStatement
FINEST: preparing statement
Nov 2, 2010 5:27:20 PM org.hibernate.persister.entity.AbstractEntityPersister dehydrate
FINEST: Dehydrating entity: [gov.dhs.ice.soa.ws.model.Civilians#473041]
Nov 2, 2010 5:27:20 PM org.hibernate.type.descriptor.sql.BasicBinder bind
FINEST: binding parameter [1] as [VARCHAR] - JOHN1
Nov 2, 2010 5:27:20 PM org.hibernate.type.descriptor.sql.BasicBinder bind
FINEST: binding parameter [2] as [VARCHAR] - BARR1
Nov 2, 2010 5:27:20 PM org.hibernate.type.descriptor.sql.BasicBinder bind
FINEST: binding parameter [3] as [INTEGER] - 473041
Nov 2, 2010 5:27:20 PM org.hibernate.type.descriptor.sql.BasicBinder bind
FINEST: binding parameter [4] as [TIMESTAMP] - 2010-11-02 17:27:20.234248

The old value, Tue Nov 02 16:42:16 EDT 2010, is what is in the database to that's why I'm getting an error. But I don't understand why you guys are updating the value at all if I set it to "generated". Shouldn't you just check against the old value and then re get after the database has updated the timestamp?

thanks,
Peter


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.