User-defined @SoftDelete(columnName = "is_deleted"). The entity has the deleted attribute and a Duplicate column error is reported when the column is saved

@Table(name = "\"user\"")
@SoftDelete(columnName = "is_deleted")
public class UserEntity {

    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    private String name;

    @Column(name = "is_deleted")
    private Boolean deleted;
UserEntity user=new UserEntity();


org.hibernate.exception.SQLGrammarException: could not prepare statement [Duplicate column name "IS_DELETED"; SQL statement:
insert into "user" (is_deleted,name,is_deleted,id) values (?,?,false,?) [42121-224]] [insert into "user" (is_deleted,name,is_deleted,id) values (?,?,false,?)]

It’s a bug that you are not seeing a bootstrap error. Please try to create a reproducer with our test case template (hibernate-test-case-templates/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/ at main · hibernate/hibernate-test-case-templates · GitHub) and if you are able to reproduce the issue, create a bug ticket in our issue tracker( and attach that reproducer.

The solution is to make the @Column(insertable = false, updatable = false)

1 Like