【发布时间】:2012-03-05 17:12:18
【问题描述】:
我有一个简单的休眠实体,有 2 个字段 - a 和 b:
@Entity
public class PlayerEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Column(nullable = false)
private Integer a;
@Column(nullable = false)
private Integer b;
}
我需要选择a - b > 5的所有玩家。
这可以使用标准的 Hibernate Criteria API 完成吗?对于这种相当典型的情况,我能否以某种方式避免使用 SQL/HQL?
谢谢!
【问题讨论】: