【问题标题】:Generating a Hibernate Criteria query from parameters从参数生成 Hibernate Criteria 查询
【发布时间】:2012-05-25 01:48:37
【问题描述】:

我必须使用从客户端获得的参数在我们的后端应用程序中创建一个查询。考虑这个图表:

我有实体(类型字段)、这些实体的字段(参数)、关系、值和操作数。所以在 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”

我真的不想在这里重新发明轮毂,所以我的问题是: 是否有使用 JPA 或更具体地说是 Hibernate 的标准工厂库,或者是否有一些可用于创建标准查询的第 3 方库?我们在前端使用 Eclipse RCP,数据通过 Apache Cxf 服务到达后端(Spring)。我希望使用 JPA 的查询语法编写可维护的代码。

【问题讨论】:

    标签: java hibernate criteria factory


    【解决方案1】:

    是的。我认为ISearch是最好的:http://code.google.com/p/hibernate-generic-dao/wiki/Search

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-26
      • 2021-02-03
      • 2012-02-15
      • 1970-01-01
      • 2023-03-19
      • 2013-07-16
      • 2019-04-01
      相关资源
      最近更新 更多