use of jakarta.persistence.criteria.From in project hibernate-orm by hibernate.
the class SingularAttributeJoinTest method testEntityModeMapJoinCriteriaQuery.
@Test
public void testEntityModeMapJoinCriteriaQuery(EntityManagerFactoryScope scope) {
scope.inEntityManager(entityManager -> {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery criteriaQuery = criteriaBuilder.createQuery();
jakarta.persistence.metamodel.EntityType distributionEntity = getEntityType(scope, "Distribution");
From distributionFrom = criteriaQuery.from(distributionEntity);
From policyJoin = distributionFrom.join("policy");
Path policyId = policyJoin.get("policyId");
criteriaQuery.select(policyId);
TypedQuery typedQuery = entityManager.createQuery(criteriaQuery);
});
}
Aggregations