In order to query the latest WTpart 'version', etc A,B.C...etc.
querySpec:
QuerySpec qs1 = new QuerySpec(); qs1.setAdvancedQueryEnabled(true); int classIndex = qs1.appendClassList( wt.part.WTPart.class, false ); SQLFunction fun=new SQLFunction(SQLFunction.MAXIMUM,new ClassAttribute( wt.part.WTPart.class , "versionInfo.identifier.versionId" ) ); qs1.appendSelect(fun, newint[] { classIndex }, false); qs1.appendWhere(new SearchCondition( wt.part.WTPartMaster.class , "number" , "=" , "test_number" ),WTPartMasterIndex );
The query result always throw exception
"A statement with aggregate function can not be used with access control."
I try to change SQLFunction MAXIMUM to "LENGTH", and It is work.
What's the hell? What can I do resovle the query requirement?