继续介绍在系统中如何查询WTDocument对象
public static WTDocument getDoc(String num){
if(num == null || num.trim().length()==0){
return null ;
}
WTDocument doc = null ;
QueryResult qr ;
try {
QuerySpec qs = new QuerySpec(WTDocument.class) ;
qs.appendWhere(new SearchCondition(WTDocument.class,WTDocument.NUMBER,SearchCondition.EQUAL,num),new int[] {0}) ;
qr = PersistenceHelper.manager.find((StatementSpec)qs);
//过滤最新版本
LatestConfigSpec ls = new LatestConfigSpec() ;
QueryResult qrLs = ls.process(qr) ;
System.out.println(qrLs.hasMoreElements()) ;
while(qrLs.hasMoreElements()){
doc = (WTDocument) qrLs.nextElement() ;
}
} catch (WTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return doc ;
}