-->
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: Default values in Oracle
PostPosted: Wed Sep 23, 2009 4:10 pm 
Newbie

Joined: Wed Sep 23, 2009 3:56 pm
Posts: 4
As part of our table definition in Oracle, many of our columns are marked as not nullable and have a default value. For instance, a column called myCol is a number, not nullable, and has a default value of 0 (zero). The hibernate annotations in my abstract class are as follows:
Code:
@Column(name = "myCol", nullable = false, precision = 4, scale = 0)

When I go to save one of my objects to the database (using session.save(myObject)) I get this error (ItemStage is the name of my generated class):
Code:
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.remitpro.hibernate.ItemStage.myCol
I'm not explicitly setting the value of myCol in java code because the database will automatically assign a default value. How do I get this to work right using hibernate?


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.