01: package org.compass.gps.device.jpa.queryprovider;
02:
03: import org.compass.gps.device.jpa.entities.EntityInformation;
04: import org.hibernate.Criteria;
05: import org.hibernate.ejb.HibernateEntityManager;
06:
07: /**
08: * @author kimchy
09: */
10: public class HibernateJpaQueryProvider extends DefaultJpaQueryProvider {
11:
12: public HibernateJpaQueryProvider(Class<?> entityClass,
13: String entityName) {
14: super (entityClass, entityName);
15: }
16:
17: public HibernateJpaQueryProvider(String selectQuery) {
18: super (selectQuery);
19: }
20:
21: /**
22: * Returns a Hibernate criteria if no <code>selectQuery</code> has been set.
23: */
24: public Criteria createCriteria(
25: HibernateEntityManager entityManager,
26: EntityInformation entityInformation) {
27: if (!isUsingDefaultSelectQuery()) {
28: return null;
29: }
30: return entityManager.getSession().createCriteria(
31: entityInformation.getEntityClass());
32: }
33:
34: }
|