Liquibase ignores @NotNull

I have @NotNull annotation for some fields. However, when I try to create a diffChangelog it removes all non-zero constraints

Example class:

public class User {

    @NotNull
    private String email;
}

      

DiffChangeSet function:

<changeSet author="author (generated)" id="1437485184491-4">
    <dropNotNullConstraint columnDataType="varchar(255)" columnName="email" tableName="user"/>
</changeSet>

      

The only solution seems to be adding extra @Column (nullable = false) annotation for each field. Can I do something so that I don't have to add additional annotation to each field.

+8


source to share


2 answers


This currently works for me when I install the add-ons:

@Column(nullable = false)

      



For some reason @NotNull doesn't work well with this org.liquibase.ext.liquibase-hibernate5

0


source


if anyone is still having problems with this, I recently found out that this was fixed in liquibase-hibernate5-3.7



0


source







All Articles