1

When using Spring boot to create an API, I've created an entity User with some fields like firstname, lastname, ...

The first time I've launched the application, the table is created in the database with all the fields.
Then I update one field adding @Column(nullable = false) to it.
And then, when I run the application again the field is not updated with the new attribute I've added to it.

In my application.properties i use this param: spring.jpa.hibernate.ddl-auto=update but it's not updating anything i don't know why

1 Answers1

1

Ensures that a column cannot have NULL value. If the column have null value then SQL query is not executing. You can delete the column first then create it again.

Eklavya
  • 17,618
  • 4
  • 28
  • 57
  • I'm not sure I clearly understood your answer ! Do you mean that if an entry in my database is null it won't change the column property otherwise I didn't undertant your question sorry. But if it's the case it's not working either because i don't have a rown with a NULL value in this column – Bastien Grignon May 01 '20 at 18:48
  • Yes check is there any row having null value for the column – Eklavya May 01 '20 at 18:55
  • I check but there is no row with a null value for this column, they all have a value different from null or different from empty – Bastien Grignon May 02 '20 at 08:44