2016-07-26 7 views
0

これらの2つのテーブルの間にjoinクエリを書くと、2つのテーブルの間にmanyToMany関係があり、プロジェクトのロード中にエラーが発生します。ここでmanyToMany joinクエリのorg.hibernate.HibernateException:エラー "

はクエリです:

@NamedQueries ({ 
@NamedQuery(name = "LicenseComponentDefinition.findByProductVerKeyType", query = "SELECT c from LicenseComponentDefinition c join c.licenseKeyTypes lkt WHERE lkt.keyTypeId = :keyTypeId AND WHERE c.product.productId = :productID AND c.productVersionByVersionStartId.versionId <= :versionId AND c.productVersionByVersionEndId.versionId >= :versionId") 

})

とエンティティクラスIは、クエリからの句に参加削除するとそれが正常に動作します

private Set<LicenseKeyType> licenseKeyTypes = new HashSet<LicenseKeyType>(0); 
@ManyToMany(fetch = FetchType.LAZY) 
@JoinTable(name = "component_definition_keytypes", catalog = "ldbredesigned", joinColumns = { 
     @JoinColumn(name = "component_definition_id", nullable = false, updatable = false) }, inverseJoinColumns = { 
       @JoinColumn(name = "license_key_type_id", nullable = false, updatable = false) }) 
public Set<LicenseKeyType> getLicenseKeyTypes() { 
    return this.licenseKeyTypes; 
} 

以下のように見えます。以下のように

SELECT c from LicenseComponentDefinition c WHERE c.product.productId = :productID AND c.productVersionByVersionStartId.versionId <= :versionId AND c.productVersionByVersionEndId.versionId >= :versionId 

誰かが助けることができますか?おかげさまで

SELECT c 
from LicenseComponentDefinition c join c.licenseKeyTypes lkt 
WHERE lkt.keyTypeId = :keyTypeId 
AND WHERE c.product.productId = :productID 
AND c.productVersionByVersionStartId.versionId <= :versionId 
AND c.productVersionByVersionEndId.versionId >= :versionId") 

初心者のための第二1を撃つ:

答えて

0

あなたの名前付きクエリは、その中にキーワードが2を持っています。