Hi,
i have this not null field 'zip' in a table 'address' and its default value is set to '78548'. But when i try to save a new object for address with zip set to null hibernate gives me an error that the 'zip' field is not null and i should give it some value. Now, the question is should'nt the hibernate be smart enough to pick up the default value for that column itself? If no then how to set a default value for a not null propoerty in hibernate?
I tried the following thing in my Address.hbm.xml but it didnt work either:
<property
name="zip"
type="java.lang.String"
not-null="true"
>
<column name="zip" default="78548"/>
</property>
any help would be great.
b.t.w. Im using Hibernate 3.1 with MySql 5
|