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?