我有简单的实体如下:
建议.java:
@Entity
public class Suggestion {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@OneToOne
private Employee author;
@OneToMany
@JoinColumn(name = "recipients_id")
private List<Employee> recipients;
}
和 Employee.java:
@Entity
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
}
我想在控制器的所有返回suggestions包含只有一个员工id在recipients列表中。
是否可以避免自定义查询(本机查询)?
我试过:
findByRecipientsContains(id) 或
findByRecipientsContaining(id)
但没有运气...
相关分类