School
和 Student
之间的关联是单向的。如何使用 JPA 标准或 Querydsl 从 Student
创建查询并加入 School
?
class School{
@OneToMany
private List<Student> students;
}
class Student{
private String name
}
最佳答案
您不能直接从学生加入到学校,但可以这样做
query.from(school, student).where(student.in(school.students))
关于java - 加入单向关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28762407/