基类中的@Where(clause =“DELETE_FLAG ='N'”)不起作用

时间:2018-01-15 08:47:51

标签: java hibernate jpa

@Data
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Where(clause = "DELETE_FLAG='N'") //enable delete flag global  //TODO:????why not work!
public abstract class AuditedEntity extends BaseEntity {

    @CreatedBy
    private String createUserId;
    @CreatedDate
    private Date createTime;
    @LastModifiedBy
    private String lastModifyUserId;
    @LastModifiedDate
    private Date lastModifyTime;

    private String deleteFlag;
} 
@Entity
@Data
@Table(name = "SYS_CATEGORY")
public class SysCategoryEntity extends AuditedEntity {
}

这里是完整的代码。当我在SysCategoryEntity上添加@Where(clause =“DELETE_FLAG ='N'”)时,它就可以了。

1 个答案:

答案 0 :(得分:0)

这似乎是一个Hibernate Bug,请参阅HHH-8873