0

バッチと位置という2つのクラスがあり、このエラーが発生しています

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();  
}
4

2 に答える 2

3

文字列にエラーがあると思います。そのはず: "from Position p where :batch member of p.positionConstraint"

于 2012-04-23T11:00:29.323 に答える
0

あなたの例は、Hibernate 3.6.8.Final とデータベース H2 1.3.160 の組み合わせで機能します。また、JPA と同等のクエリを使用:

select from Position p where :batch member of p.positionConstraint

使用している Hibernate のバージョンによっては、まだ開いているバグHHH-5209に直面している可能性があります。また、HHH-5173 には追加の説明が記載されています。

于 2012-04-23T17:29:16.943 に答える