论坛首页 Java企业应用论坛

Gavin 要使用的 “Criteria” 是什么东西?

浏览 3392 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2003-12-05  
Gavin and the Hibernate are looking into what makes a great "Query by Criteria" design. Wrapping an OO model on top of SQL is tough, and this piece walks through various design choices. It is always interesting to watch thought progression such as this.

Gavin ends up "considering supporting something like the following in Hibernate":

session.createCriteria(Project.class)
  .createDisjunction()
      .add( eq("name", "Hibernate") )
      .add( like("description", "%ORM%") )
  .list();
  
Do you have any thoughts? Has anyone worked with a great Query by Criteria API that they loved? Are you someone who would rather just do it in SQL?

谁知道这里的Criteria API 是什么东西?
   发表时间:2003-12-05  
Criteria以面向对象的方式来查询,而不像hql那样。
0 请登录后投票
   发表时间:2003-12-07  
Criteria我最早是在Patterns of Enterprise Application Architecture里看到的,作为Query Object使用。Jakarta的O/R map项目Torque的查询方式就用了Criteria。Torque我用了一两个月了,用下来感觉Criteria并不比sql好,只能说在应用中各有千秋,要用好Criteria不熟悉SQL还是不行。
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics