io.crnk.jpa.internal.query.EntityGraphBuilderImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of crnk-jpa Show documentation
Show all versions of crnk-jpa Show documentation
JSON API framework for Java
package io.crnk.jpa.internal.query;
import io.crnk.meta.model.MetaAttributePath;
import javax.persistence.EntityGraph;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.Subgraph;
import java.util.Set;
public class EntityGraphBuilderImpl implements EntityGraphBuilder {
@Override
public void build(EntityManager em, Query criteriaQuery, Class entityClass,
Set fetchPaths) {
EntityGraph graph = em.createEntityGraph(entityClass);
for (MetaAttributePath fetchPath : fetchPaths) {
applyFetchPaths(graph, fetchPath);
}
criteriaQuery.setHint("javax.persistence.fetchgraph", graph);
}
private Subgraph
© 2015 - 2025 Weber Informatics LLC | Privacy Policy