use of org.apache.ojb.broker.query.ReportQueryByCriteria in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestDaoOjb method getObjectIdByPaymentRequestDocumentNumber.
@Override
public String getObjectIdByPaymentRequestDocumentNumber(String documentNumber) {
// Build PREQ query that matches only on document number.
Criteria crit = new Criteria();
crit.addEqualTo("documentNumber", documentNumber);
// Prepare report query that only retrieves object ID.
ReportQueryByCriteria reportQuery = QueryFactory.newReportQuery(PaymentRequestDocument.class, crit);
reportQuery.setAttributes(new String[] { "objectId" });
reportQuery.setJdbcTypes(new int[] { java.sql.Types.VARCHAR });
// Run query and return results.
Iterator<Object[]> results = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(reportQuery);
if (results.hasNext()) {
return (String) results.next()[0];
}
return null;
}
Aggregations