您的位置:首页 > 其它

查询某个状态的最新版本对象

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) {}}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐