We running on an Oracle 10g database and many of our columns are set up such that the value cannot be null but a default value is defined:
Code:
MYCOL VARCHAR2(1) default 'N' not null
DATE_CREATED DATE default sysdate
As I'm working with hibernate in my code I create an entity object and set some of the field values. I'd like Oracle to use the defaults for both of the columns I listed above columns so I don't set the values, thinking the defaults will be used. No, instead I get this error:
Code:
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.mycompany.myentity.dateCreated
So my question is, what is the best practice to tell Hibernate to allow the database to use the default value for columns?
Edit:
I should add that we're using Hibernate 3.3.2 with Annotations