-->
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: Can I override the default value of a @Generated field?
PostPosted: Thu Nov 05, 2009 3:00 pm 
Newbie

Joined: Thu Nov 05, 2009 1:56 pm
Posts: 1
Hi there,

I have an updatedOn field annotated with @Generated(@Generated(GenerationTime.ALWAYS)).

The database is MySQL and the column is defined as:

`updatedOn` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

I want to be able to override the default value when I insert. This is necessary to implement versionning where I'd like to copy a row, including its updatedOn column.

I understand the current Hibernate behavior. However, the way I see it, a default value is the value used by the database when no value is provided. Currently, the updatedOn column is not included in the generated SQL, but is refetched after the insert.

Thank you for your help.

Remy


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.