[jboss-user] [EJB 3.0] - Temporals and ON UPDATE CURRENT_TIMESTAMP
do-not-reply at jboss.com
Wed Sep 17 07:58:45 EDT 2008
I have an entity bean with a field "dtupdated" that I would like to have
set to the current timestamp on each update of the dataset. It is annotated
the following way.
@Column(columnDefinition="TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
private Date dtupdated;
My DB is mySQL.
If I retrieve this entity bean from the DB now, make changes and write it back to the database, the dtupdated field will of course not be set to CURRENT_TIMESTAMP, because it's previous value will be explicitly passed in the UPDATE statement on the DB and CURRENT_TIMESTAMP is only set, if a NULL value is passed...
How can I create a field with the desired behaviour? Any good solutions out there?
Thanks a lot for your help -
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4177086#4177086
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4177086
More information about the jboss-user