All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.compass.gps.device.jpa.queryprovider.HibernateJpaQueryProvider Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package org.compass.gps.device.jpa.queryprovider;

import org.compass.gps.device.jpa.entities.EntityInformation;
import org.hibernate.Criteria;
import org.hibernate.ejb.HibernateEntityManager;

/**
 * @author kimchy
 */
public class HibernateJpaQueryProvider extends DefaultJpaQueryProvider {

    public HibernateJpaQueryProvider(Class entityClass, String entityName) {
        super(entityClass, entityName);
    }

    public HibernateJpaQueryProvider(String selectQuery) {
        super(selectQuery);
    }

    /**
     * Returns a Hibernate criteria if no selectQuery has been set.
     */
    public Criteria createCriteria(HibernateEntityManager entityManager, EntityInformation entityInformation) {
        if (!isUsingDefaultSelectQuery()) {
            return null;
        }
        return entityManager.getSession().createCriteria(entityInformation.getEntityClass());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy