Problems with the Hibernate update

Asked

Viewed 49 times

1

I’m having some unforeseen events with Hibernate in my application.

I wonder if the implementations of annotations made in class java are taken to the database or processed only within the system, as I added the @NotNull in a field, and after Restart did not take this implementation to the bank.

My configuration of Hibernate is as update, and fields are normally added when modified.

I don’t understand why Hibernate did not automatically modify this in the bank, and led me to doubt whether those annotations are correct.

Thank you.

1 answer

3

The @NotNull validates only in the system as it is part of the specification of the Bean Validation, if you do not want the null bank field then you can put @Column(nullable = false) which is the specification of JPA

Ex:

@Column(nullable = false)
private String nome;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.