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: when does hibernate default works
PostPosted: Tue Nov 24, 2009 8:59 pm 
Newbie

Joined: Tue Nov 24, 2009 8:43 pm
Posts: 1
Hi,
Can anyone explain why the default attribute is not working for me.

<property name="createdOn" type="date" >
<column name="CREATED_ON" default = " ' sysdate' " />
</property>

If I dont set a date for the createdOn field, I expected current date to be present in the table.
Did I miss something over there?


I do not want to do this default initialization in my java setter methods


Top
 Profile  
 
 Post subject: Re: when does hibernate default works
PostPosted: Wed Nov 25, 2009 6:50 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
the default expression is passed to the database create-statement. If hibernate does not create the db, it does not take effect (neither if you have hbm2ddl set to auto on an already existing table).

_________________
-----------------
Need advanced help? http://www.viada.eu


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.