I'm using Hibernate 3.5.6 and JPA 2.
Here is my code:
public List<Route> searchRoutesEndingAt(GeoLocation destinationLocation,
int destinationRangeInMeters, RouteUserPref routeUserPref) {
Query query = entityManager.createNamedQuery("searchRoutesEndingAt");
query.setParameter("lat1", destinationLocation.getLatitude());
query.setParameter("lng1", destinationLocation.getLongitude());
query.setParameter("destinationRangeInMeters", destinationRangeInMeters);
try {
return query.getResultList();
} catch (NoResultException ex) {
return null;
}
}
In the above code I want to filter the result set according to routeUserPref which has various attributes.