我有两个名为 Batch 和 Position 的类,我遇到了这个错误
Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [from bean.Position p where :batch member of p.positionConstraint]
当调用 findByStudent 方法时。如果有帮助,我也在使用 JPA。非常感谢
public class Position {
@ElementCollection
@LazyCollection(LazyCollectionOption.FALSE)
@CollectionTable(name = "position_constraint")
private List<Batch> positionConstraint;
}
public class Batch {
private College college;
private YearLevel yearLevel;
@Override
public List<Position> findByStudent(StudentInformation student) {
Batch batch = new Batch(student.getCollege(), student.getYearLevel());
Query query = getEntityManager().createQuery(
"from Position p where :batch member of p.positionConstraint").setParameter("batch", batch);
return query.getResultList();
}