1

In java hibernate how to set the default value from the database in column if the value inseting is null using hibernate hbm property?

Ridcully
  • 23,362
  • 7
  • 71
  • 86
aswar shan
  • 11
  • 1
  • 1
    Possible 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 Answers1

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