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

io.crnk.jpa.internal.QueryFactoryDiscovery Maven / Gradle / Ivy

There is a newer version: 2.6.20180522184741
Show newest version
package io.crnk.jpa.internal;

import io.crnk.core.engine.internal.utils.ClassUtils;
import io.crnk.jpa.query.JpaQueryFactory;
import io.crnk.jpa.query.criteria.JpaCriteriaQueryFactory;
import io.crnk.jpa.query.querydsl.QuerydslQueryFactory;

/**
 * Checks for the presence of QueryDSL and makes use of it. Otherwise fallsback
 * to Criteria aPI.
 */
public class QueryFactoryDiscovery {


	public JpaQueryFactory discoverDefaultFactory() {
		if (ClassUtils.existsClass("com.querydsl.jpa.impl.JPAQuery")) {
			return QuerydslQueryFactory.newInstance();
		} else {
			return JpaCriteriaQueryFactory.newInstance();
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy