我有两个名为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();
}
答案 0 :(得分:3)
我认为你的字符串中有错误。它应该是:
"from Position p where :batch member of p.positionConstraint"
答案 1 :(得分:0)