Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liquibase ignores @NotNull

I have @NotNull annotation on some fields. However when I try to generate a diffChangelog, it drops all the not null constraints

Sample Class :

public class User {

    @NotNull
    private String email;
}

The diffChangeSet :

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

The only solution seems to be adding an extra annotation @Column(nullable = false) on every field. Can i do anything so that I do not have to add an extra annotation on every field.

like image 955
Kechit Goyal Avatar asked Jul 21 '15 14:07

Kechit Goyal


1 Answers

if anyone still has problem with this I recently found out that it has been fixed in liquibase-hibernate5-3.7

like image 92
Kamil Avatar answered Oct 02 '22 20:10

Kamil