[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4057) Error occurs when the not-null column has a default value in the DB but the field in object has no default value.
Rupesh Kumar (JIRA)
noreply at atlassian.com
Fri Jul 24 09:21:12 EDT 2009
Error occurs when the not-null column has a default value in the DB but the field in object has no default value.
-----------------------------------------------------------------------------------------------------------------
Key: HHH-4057
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4057
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: Hibernate 3.3.2
Reporter: Rupesh Kumar
I have a column in the database which is not null and has a default value.
In the Java object, I don't have any default value set on the field mapped to this column. When this object is saved, Hibernate throws up an error because it tried to insert a null value in the not-null column. Since DB can generate the value for this column, hibernate should use that.
I can not use generated attribute in hibernate mapping file because this column value is not always generated. It is generated only when no value is specified for this column while inserting.
Hibernate should inspect the database and find out which columns has default value set on it. If there is anything set on it, insert should ignore the mapped field if the value is not defined for it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list