Using hibernate hbm2ddl.auto=update : How can I alter column not to require value anymore?

StackOverflow https://stackoverflow.com/questions/801915

  •  03-07-2019
  •  | 
  •  

Question

I had a property that used to be not-null="true". Values aren't necessary for that field anymore so I changed it to not-null="false" but the table does not get updated in the database. Adding new properties doesn't give any problems.

Is it possible for hbm2ddl.auto=update to change the the table automatically to remove the not-null="true"? (I know I can just write a sql script to change it but would like to let it get updated automagically)

Was it helpful?

Solution

From what I could gather: hbm2ddl.auto=update won't change not-null value for tables that already have data in.

In the end I just wrote a sql script to change the table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top