use of javax.persistence.TypedQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentDao method findFaReportByIdAndScheme.
/**
* Get FaReportDocument by one or more Report identifiers
*
* @param reportId
* @param schemeId
* @return FaReportDocumentEntity
* @throws ServiceException
*/
public FaReportDocumentEntity findFaReportByIdAndScheme(String reportId, String schemeId) throws ServiceException {
TypedQuery query = getEntityManager().createNamedQuery(FaReportDocumentEntity.FIND_BY_FA_ID_AND_SCHEME, FaReportDocumentEntity.class);
query.setParameter(REPORT_ID, reportId);
query.setParameter(SCHEME_ID, schemeId);
query.setMaxResults(1);
List<FaReportDocumentEntity> entities = query.getResultList();
if (!entities.isEmpty()) {
return entities.get(0);
} else {
return null;
}
}
use of javax.persistence.TypedQuery in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripDao method getQueryForFilterFishingTrips.
private Query getQueryForFilterFishingTrips(FishingActivityQuery query) throws ServiceException {
FishingTripSearchBuilder search = new FishingTripSearchBuilder();
// Create SQL Dynamically based on Filters provided
StringBuilder sqlToGetActivityList = search.createSQL(query);
log.debug("SQL:" + sqlToGetActivityList);
Query typedQuery = em.createQuery(sqlToGetActivityList.toString());
return search.fillInValuesForTypedQuery(query, typedQuery);
}
Aggregations