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

io.katharsis.jpa.internal.query.backend.querydsl.QuerydslQueryImpl Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package io.katharsis.jpa.internal.query.backend.querydsl;

import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;

import com.querydsl.jpa.impl.JPAQueryFactory;

import io.katharsis.jpa.internal.meta.MetaLookup;
import io.katharsis.jpa.internal.query.AbstractJpaQueryImpl;
import io.katharsis.jpa.internal.query.ComputedAttributeRegistryImpl;
import io.katharsis.jpa.query.querydsl.QuerydslQuery;

public class QuerydslQueryImpl extends AbstractJpaQueryImpl> implements QuerydslQuery {

	private JPAQueryFactory queryFactory;

	public QuerydslQueryImpl(MetaLookup metaLookup, EntityManager em, Class clazz,
			ComputedAttributeRegistryImpl computedAttrs) {
		super(metaLookup, em, clazz, computedAttrs);
		queryFactory = new JPAQueryFactory(em);
	}

	public QuerydslQueryImpl(MetaLookup metaLookup, EntityManager em, Class clazz,
			ComputedAttributeRegistryImpl virtualAttrs, String attrName, List entityIds) {
		super(metaLookup, em, clazz, virtualAttrs, attrName, entityIds);
		queryFactory = new JPAQueryFactory(em);
	}

	@Override
	public QuerydslExecutorImpl buildExecutor() {
		return (QuerydslExecutorImpl) super.buildExecutor();
	}

	protected JPAQueryFactory getQueryFactory() {
		return queryFactory;
	}

	@Override
	protected QuerydslQueryBackend newBackend() {
		return new QuerydslQueryBackend<>(this, clazz, parentEntityClass, parentAttr, parentIdSelection);
	}

	@Override
	protected QuerydslExecutorImpl newExecutor(QuerydslQueryBackend ctx, int numAutoSelections, Map selectionBindings) {
		return new QuerydslExecutorImpl<>(em, meta, ctx.getQuery(), numAutoSelections, selectionBindings);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy