org.hibernate.criterion.Example(用法解释)
查询示例
org.hibernate.criterion.Example
类允许你通过一个给定实例构建一个条件查询。
此实例的属性值将做成查询条件。
程序代码
Cat cat = new Cat();
cat.setSex('F');
cat.setColor(Color.BLACK);
List results = session.createCriteria(Cat.class)
.add( Example.create(cat))
.list();
Example.create(cat) 表示根据cat这个对象来构造一个查询条件。
上面这条语句将查询sex 为 F 而且Color为BLACK的所有Cat记录。
版本属性、标识符和关联被忽略。默认情况下值为null的属性将被排除。
可以自行调整Example使之更实用。
程序代码
Example example = Example.create(cat)
.excludeZeroes() //排除值为0的属性
.excludeProperty("color") //排除 color属性
.ignoreCase() //忽略大小写
.enableLike(); //启用模糊查询
List results = session.createCriteria(Cat.class)
.add(example)
.list();
甚至可以使用examples在关联对象上放置条件。
程序代码
List results = session.createCriteria(Cat.class)
.add( Example.create(cat) )
.createCriteria("mate")
.add( Example.create( cat.getMate() ) )
.list();
分享到:
相关推荐
org.hibernate.criterion A framework for defining restriction criteria and order criteria. org.hibernate.mapping This package defines the Hibernate configuration-time metamodel. org.hibernate....
org.hibernate.criterion A framework for defining restriction criteria and order criteria. org.hibernate.mapping This package defines the Hibernate configuration-time metamodel. org.hibernate....
hibernate_criterion.rarhibernate_criterion.rarhibernate_criterion.rar
Hibernate 提供了操纵对象和相应的 RDBMS 表中可用的数据的替代方法。一种方法是标准的 API,它允许你建立一个标准的可编程查询对象来应用过滤规则和逻辑条件。 Hibernate Session 接口提供了 createCriteria() ...
1.6 Example Codeand AdditionalInformation . . . . . . . . . . . . . . . . . . . . . 5 1.7 Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 Introduction to C++...
criterion.rs, 统计驱动的微型基准 在 Rust / 用户指南 getting/用户指南/用户指南| API文档 Changelog | | | Criterion.rs 可以以帮助你通过检测和测量性能改进或者回归,快速。准确地编写快速代码。 你可以满怀...
criterion简介 hibernate
1.5.4. Example of the binary symmetric channel . . . . . . . . . . . . . . . 21 1.5.4.1. Hamming’s metric . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1.5.4.2. Decoding with minimal ...
euler_criterion.rs 这是的“外部基准测试”功能的试验场。 在这里,我对以几种编程语言编写的解决方案进行基准测试,(现在)在一个图中粗略地比较它们。 内容 情节+源文件: 原始数据(均值/中位数/等的估计,所有...
货物标准 Criterion-rs货运扩展 ... 不使用Criterion.rs或使用较早版本的基准将正常运行,但不会从货运标准的某些功能中受益。 首先安装货运标准: cargo install cargo-criterion 然后,您可以使用它来运行Cri
A general anisotropic yield criterion using bounds and a transformation weighting tensor. J. Mech. Phys. Solids 41, 1859-1886.] is proposed in order to consider the influence of strain path change on...
内容为pdf文字版介绍5G的编码与调制,主体为turbo吗,也介绍了BCH码和LDPC码 1 Historical Perspective, Motivation and Outline 1 1.1 AHistoricalPerspective onChannelCoding . . . . . . . ....1.1.1 A Historical ...
Kelly Criterion
In Analog systems, the chief objective is the fidelity of reproduction of waveforms, hence, the suitable performance criterion is the output signal to noise ratio. The choice of this criterion stems ...
Error Correction Coding - Mathematical Methods and Algorithms (Source Files Contained).pdf Error Correction Coding Mathematical Methods and Algorithms Todd K....Utah State University ...
Routh-Hurwitz stability criterion, revisted:有关劳斯判据失效的情况分析,国内控制理论教材里没有提到,值得阅读。
利用Fisher准则计算两类数据间的类间离散矩阵和类内离散矩阵
iOS CoreData 一本好书,smartrookie ■ Chapter 1: Getting Started .......................................................................................................................
4.9 An Aitken Acceleration-Based Stopping Criterion. 4.10 conjugate Gradient Acceleration of EM Algorithm. 4.11 Hybrid Methods for Finding the MLE. 4.12 A GEM Algorithm Based on One Newton-Raphson ...
LNCS 2009-4 Evolutionary Multi-Criterion Optimization