In java hibernate how to set the default value from the database in column if the value inseting is null using hibernate hbm property?
Asked
Active
Viewed 592 times
1
-
1Possible duplicate of: https://stackoverflow.com/questions/3110266/how-to-set-default-value-in-hibernate or https://stackoverflow.com/questions/18624627/mysql-hibernate-default-value-for-not-null-column-does-not-work – Boris Pavlović Oct 05 '15 at 11:45
-
But this is not working when i try to enter the default value only the null value is entering into the table – aswar shan Oct 05 '15 at 11:48
1 Answers
0
For .hbm files you can use,default element Ex:-
<column name="age" not-null="true" default="18"/>

Kumar Abhinav
- 6,565
- 2
- 24
- 35
-
this didn't work by i think not-null is used to set the column as not null – aswar shan Oct 06 '15 at 10:29