我有两个类称为批处理中的地位与调用方法findByStudent当我有这个错误休眠QuerySyntaxException
Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [from bean.Position p where :batch member of p.positionConstraint]
。如果有帮助,我也使用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();
}
我用批次替换了批量,仍然不起作用 – louieansonng 2012-04-23 11:20:21
@louieansonng - 再次阅读答案。小心。 – 2012-04-23 11:25:27
@Stephen C对不起,它仍然不起作用。我更新了主要问题以防万一。 – louieansonng 2012-04-23 11:29:47