2012-05-17 8 views
0

生成休眠條件查詢我必須使用從客戶端獲取的參數在我們的後端應用程序中創建一個查詢。考慮一下這個圖:從參數

enter image description here

我有實體(類型字段),這些實體的字段(參數)的關係,一個值和一個操作數。所以在SQL術語表上面的翻譯本:

... WHERE Item.reach_complience = 」<1%」 
    and Item.technical.type = 」RES」 
    and Item.technical.value <= 」1k」 
    and Item.technical.value >= 」4K7」 
    and (Item.technical.footprint = 」RC0603」 or Item.technical.footprint = 」RC0805」) 
    and Item.classification.incurrent_handling = 」prefered-to-use」 

我真的不想在這裏重塑WEEL,所以我的問題是: 有它使用JPA或更具體的標準工廠libarary休眠或是否有一些第三方庫可用於創建標準查詢?我們在前端使用Eclipse RCP,數據通過Apache Cxf服務到達後端(Spring)。我希望使用JPA的查詢語法編寫可維護的代碼。

回答