-->
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: Use database default value if property is null?
PostPosted: Wed Jul 30, 2008 7:08 am 
Newbie

Joined: Mon Oct 16, 2006 7:55 am
Posts: 5
Hello!

I would like that a database's default value is used when doing an INSERT if a property is null.

For example:
<class name="Person" table="Person">
[....]
<property name="faktor" type="double">
<column name="faktor" default="1.0" />
</property>
</class>

In the Java code I create a new object Person, do not fill in the property faktor and save it in the database. But instead of the default value "1.0", NULL is saved. But I would like that 1.0 is saved.

Can someone help me out?

Thanks in advance,
Martin


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.