JPA - @Where注解 - 添加条件查询
前言
这里介绍@Where注解给Entity统一添加条件查询。
具体实现
- Product.java
@Entity
@Getter
@Setter
@Where(clause = "delete_time is null")
public class Product {
@Id
private int id;
private String title;
private Date createTime;
private Date deleteTime;
}
- 实现效果
![](https://img-blog.csdnimg.cn/d1b51b924c4d4ea88f8fecaa32708d63.jpg)