查询某个状态的最新版本对象
2010-03-05 10:37
399 查看
public static Persistable getPersistable(String number,
Class clazz, String stateStr) throws WTException {
QueryResult result = null;
try {
QuerySpec queryspec = new QuerySpec(clazz);
LifeCycleConfigSpec lifecycleConfig = new LifeCycleConfigSpec();
lifecycleConfig.setLifeCycleState(State.toState(stateStr.toUpperCase()));
queryspec = lifecycleConfig.appendSearchCriteria(queryspec);
WhereExpression where = new SearchCondition(clazz, "master>number", "=", number);
if(queryspec.getConditionCount()>0 && queryspec.getWhere().endsWith(")")){
queryspec.appendAnd();
}
queryspec.appendWhere(where, new int[] { 0 });
result = PersistenceHelper.manager.find((StatementSpec) queryspec);
LatestConfigSpec configSpec = new LatestConfigSpec();
result = configSpec.process(result);
} catch (Exception e) {}}
Class clazz, String stateStr) throws WTException {
QueryResult result = null;
try {
QuerySpec queryspec = new QuerySpec(clazz);
LifeCycleConfigSpec lifecycleConfig = new LifeCycleConfigSpec();
lifecycleConfig.setLifeCycleState(State.toState(stateStr.toUpperCase()));
queryspec = lifecycleConfig.appendSearchCriteria(queryspec);
WhereExpression where = new SearchCondition(clazz, "master>number", "=", number);
if(queryspec.getConditionCount()>0 && queryspec.getWhere().endsWith(")")){
queryspec.appendAnd();
}
queryspec.appendWhere(where, new int[] { 0 });
result = PersistenceHelper.manager.find((StatementSpec) queryspec);
LatestConfigSpec configSpec = new LatestConfigSpec();
result = configSpec.process(result);
} catch (Exception e) {}}
相关文章推荐
- 最新版本Lucene 4.2.1入门教程(查询构造)
- DataRow对象的行状态(RowState)和行版本(DataRowVersion)属性的特点及关系简述
- 最新最全的maven依赖项版本查询网站:
- JAVAEE学习——hibernate02:实体规则、对象状态、缓存、事务、批量查询和实现客户列表显示
- Activiti 查询最新版本的流程定义
- apklug插件托管服务开发教程之查询已安装插件版本状态-03
- 2017最新版本 elasticSearch5.3.0笔记 查询教程
- DataRow对象的行状态(RowState)和行版本(DataRowVersion)属性
- PSCC 64位滤镜 ps汉化滤镜大全-最新版本查询(收藏版)
- Activiti 查询最新版本的流程定义
- 将升级目标对象更新到最新的版本1
- JQuery DataTables 服务端自定义查询(最新版本介绍)
- Activiti查询最新版本的流程定义集合
- 【最新Xcode9.2】Xcode 离线包下载方法,Xcode与OX 版本对照查询
- activiti学习--04流程定义:流程定义组成+部署流程定义+查询流程定义+删除流程定义+删除流程定义+查询最新版本的流程定+查询最新版本的流程定义
- 将升级目标对象更新到最新的版本2
- Hibernate三种状态;query查询;ResultTransformer转换为pojo对象;可以将query语句写在xml中;Criteria查询;ProjectionList总和/f分组等函数
- 获取一个系统中的可用的最新版本的DomDocument对象
- 通过论证:查询字段通常返回引用,该引用可以保证是原来的对象的状态的一部分。分析变量在内存中的变化过程。
- 全面介绍Windows内存管理机制及C++内存分配实例(二):内存状态查询