Search in sources :

Example 1 with ReportQueryByCriteria

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;
}
Also used : ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

Aggregations

Criteria (org.apache.ojb.broker.query.Criteria)1 QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)1 ReportQueryByCriteria (org.apache.ojb.broker.query.ReportQueryByCriteria)1