Search in sources :

Example 1 with Fetchable

use of org.hibernate.sql.results.graph.Fetchable in project hibernate-orm by hibernate.

the class CriteriaEntityGraphTest method getFetchable.

private Fetchable getFetchable(String attributeName, Class entityClass) {
    EntityPersister person = scope.getSessionFactory().getRuntimeMetamodels().getMappingMetamodel().findEntityDescriptor(entityClass.getName());
    Collection<AttributeMapping> attributeMappings = person.getAttributeMappings();
    Fetchable fetchable = null;
    for (AttributeMapping mapping : attributeMappings) {
        if (mapping.getAttributeName().equals(attributeName)) {
            fetchable = (Fetchable) mapping;
        }
    }
    return fetchable;
}
Also used : EntityPersister(org.hibernate.persister.entity.EntityPersister) Fetchable(org.hibernate.sql.results.graph.Fetchable) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping)

Example 2 with Fetchable

use of org.hibernate.sql.results.graph.Fetchable in project hibernate-orm by hibernate.

the class CriteriaEntityGraphTest method testFetchSemanticsWithDeepSubgraph.

@Test
void testFetchSemanticsWithDeepSubgraph() {
    scope.inTransaction(session -> {
        final RootGraphImplementor<Cat> eg = session.createEntityGraph(Cat.class);
        eg.addSubgraph("owner", Person.class).addSubgraph("company", ExpressCompany.class);
        final SelectStatement sqlAst = buildSqlSelectAst(Cat.class, eg, GraphSemantic.FETCH, session);
        // Check the from-clause
        assertEntityValuedJoinedGroup(sqlAst, "owner", Person.class, tableGroup -> {
            List<TableGroupJoin> tableGroupJoins = tableGroup.getTableGroupJoins();
            Map<String, Class<? extends TableGroup>> tableGroupByName = tableGroupJoins.stream().map(TableGroupJoin::getJoinedGroup).collect(Collectors.toMap(tg -> tg.getModelPart().getPartName(), TableGroup::getClass));
            Map<String, Class<? extends TableGroup>> expectedTableGroupByName = new HashMap<>();
            expectedTableGroupByName.put("homeAddress", StandardVirtualTableGroup.class);
            expectedTableGroupByName.put("company", LazyTableGroup.class);
            assertThat(tableGroupByName, is(expectedTableGroupByName));
        });
        // Check the domain-result graph
        assertDomainResult(sqlAst, Cat.class, "owner", Person.class, entityFetch -> {
            assertThat(entityFetch, instanceOf(EntityFetchJoinedImpl.class));
            final EntityResult ownerEntityResult = ((EntityFetchJoinedImpl) entityFetch).getEntityResult();
            final Map<String, Class<? extends Fetch>> fetchClassByAttributeName = ownerEntityResult.getFetches().stream().collect(Collectors.toMap(fetch -> fetch.getFetchedMapping().getPartName(), Fetch::getClass));
            final Map<String, Class<? extends Fetch>> expectedFetchClassByAttributeName = new HashMap<>();
            expectedFetchClassByAttributeName.put("homeAddress", EmbeddableFetchImpl.class);
            expectedFetchClassByAttributeName.put("pets", DelayedCollectionFetch.class);
            expectedFetchClassByAttributeName.put("company", EntityFetchJoinedImpl.class);
            assertThat(fetchClassByAttributeName, is(expectedFetchClassByAttributeName));
            Fetchable fetchable = getFetchable("company", Person.class);
            final Fetch companyFetch = ownerEntityResult.findFetch(fetchable);
            List<Fetch> fetches = ownerEntityResult.getFetches();
            assertThat(companyFetch, notNullValue());
            final EntityResult companyEntityResult = ((EntityFetchJoinedImpl) companyFetch).getEntityResult();
            assertThat(companyEntityResult.getFetches(), hasSize(1));
            final Fetch shipAddressesFetch = companyEntityResult.getFetches().get(0);
            assertThat(shipAddressesFetch.getFetchedMapping().getPartName(), is("shipAddresses"));
            assertThat(shipAddressesFetch, instanceOf(DelayedCollectionFetch.class));
        });
    });
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Entity(jakarta.persistence.Entity) AssignableMatcher.assignableTo(org.hibernate.testing.hamcrest.AssignableMatcher.assignableTo) EntityPersister(org.hibernate.persister.entity.EntityPersister) GraphSemantic(org.hibernate.graph.GraphSemantic) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) EntityValuedModelPart(org.hibernate.metamodel.mapping.EntityValuedModelPart) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) Assert.assertThat(org.junit.Assert.assertThat) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) TestForIssue(org.hibernate.testing.TestForIssue) SqmQueryImplementor(org.hibernate.query.hql.spi.SqmQueryImplementor) SessionFactoryScopeAware(org.hibernate.testing.orm.junit.SessionFactoryScopeAware) Map(java.util.Map) EntityResult(org.hibernate.sql.results.graph.entity.EntityResult) FetchType(jakarta.persistence.FetchType) Fetchable(org.hibernate.sql.results.graph.Fetchable) EntityDelayedFetchImpl(org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchImpl) SqmSelectStatement(org.hibernate.query.sqm.tree.select.SqmSelectStatement) CollectionUtils(org.junit.platform.commons.util.CollectionUtils) LazyTableGroup(org.hibernate.sql.ast.tree.from.LazyTableGroup) Collection(java.util.Collection) DomainResult(org.hibernate.sql.results.graph.DomainResult) Set(java.util.Set) Id(jakarta.persistence.Id) DomainModel(org.hibernate.testing.orm.junit.DomainModel) QuerySqmImpl(org.hibernate.query.sqm.internal.QuerySqmImpl) Collectors(java.util.stream.Collectors) EmbeddableFetchImpl(org.hibernate.sql.results.graph.embeddable.internal.EmbeddableFetchImpl) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) Test(org.junit.jupiter.api.Test) LoadQueryInfluencers(org.hibernate.engine.spi.LoadQueryInfluencers) List(java.util.List) SessionImplementor(org.hibernate.engine.spi.SessionImplementor) FromClause(org.hibernate.sql.ast.tree.from.FromClause) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) OneToMany(jakarta.persistence.OneToMany) ManyToOne(jakarta.persistence.ManyToOne) HashMap(java.util.HashMap) EnumSource(org.junit.jupiter.params.provider.EnumSource) Embedded(jakarta.persistence.Embedded) RootGraphImplementor(org.hibernate.graph.spi.RootGraphImplementor) QueryImplementor(org.hibernate.query.spi.QueryImplementor) CollectionMatchers.hasSize(org.hibernate.testing.hamcrest.CollectionMatchers.hasSize) StandardSqmTranslator(org.hibernate.query.sqm.sql.internal.StandardSqmTranslator) Embeddable(jakarta.persistence.Embeddable) CollectionMatchers.isEmpty(org.hibernate.testing.hamcrest.CollectionMatchers.isEmpty) ElementCollection(jakarta.persistence.ElementCollection) SqmTranslation(org.hibernate.query.sqm.sql.SqmTranslation) Fetch(org.hibernate.sql.results.graph.Fetch) Consumer(java.util.function.Consumer) EntityFetch(org.hibernate.sql.results.graph.entity.EntityFetch) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) CriteriaQuery(jakarta.persistence.criteria.CriteriaQuery) StandardVirtualTableGroup(org.hibernate.sql.ast.tree.from.StandardVirtualTableGroup) SessionFactoryScope(org.hibernate.testing.orm.junit.SessionFactoryScope) CriteriaBuilder(jakarta.persistence.criteria.CriteriaBuilder) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping) SessionFactory(org.hibernate.testing.orm.junit.SessionFactory) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) EntityFetchJoinedImpl(org.hibernate.sql.results.graph.entity.internal.EntityFetchJoinedImpl) EntityFetchJoinedImpl(org.hibernate.sql.results.graph.entity.internal.EntityFetchJoinedImpl) Fetchable(org.hibernate.sql.results.graph.Fetchable) LazyTableGroup(org.hibernate.sql.ast.tree.from.LazyTableGroup) StandardVirtualTableGroup(org.hibernate.sql.ast.tree.from.StandardVirtualTableGroup) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) HashMap(java.util.HashMap) EntityResult(org.hibernate.sql.results.graph.entity.EntityResult) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) Fetch(org.hibernate.sql.results.graph.Fetch) EntityFetch(org.hibernate.sql.results.graph.entity.EntityFetch) SqmSelectStatement(org.hibernate.query.sqm.tree.select.SqmSelectStatement) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with Fetchable

use of org.hibernate.sql.results.graph.Fetchable in project hibernate-orm by hibernate.

the class EntityGraphLoadPlanBuilderTest method testFetchLoadPlanBuildingWithDeepSubgraph.

@Test
void testFetchLoadPlanBuildingWithDeepSubgraph() {
    scope.inTransaction(em -> {
        final RootGraphImplementor<Cat> eg = em.createEntityGraph(Cat.class);
        eg.addSubgraph("owner", Person.class).addSubgraph("company", ExpressCompany.class);
        final SelectStatement sqlAst = buildSqlSelectAst(Cat.class, eg, GraphSemantic.FETCH, scope);
        // Check the from-clause
        assertEntityValuedJoinedGroup(sqlAst, "owner", Person.class, tableGroup -> {
            List<TableGroupJoin> tableGroupJoins = tableGroup.getTableGroupJoins();
            Map<String, Class<? extends TableGroup>> tableGroupByName = tableGroupJoins.stream().map(TableGroupJoin::getJoinedGroup).collect(Collectors.toMap(tg -> tg.getModelPart().getPartName(), TableGroup::getClass));
            Map<String, Class<? extends TableGroup>> expectedTableGroupByName = new HashMap<>();
            expectedTableGroupByName.put("homeAddress", StandardVirtualTableGroup.class);
            expectedTableGroupByName.put("company", LazyTableGroup.class);
            assertThat(tableGroupByName, is(expectedTableGroupByName));
        });
        // Check the domain-result graph
        assertDomainResult(sqlAst, Cat.class, "owner", Person.class, entityFetch -> {
            assertThat(entityFetch, instanceOf(EntityFetchJoinedImpl.class));
            final EntityResult ownerEntityResult = ((EntityFetchJoinedImpl) entityFetch).getEntityResult();
            final Map<String, Class<? extends Fetch>> fetchClassByAttributeName = ownerEntityResult.getFetches().stream().collect(Collectors.toMap(fetch -> fetch.getFetchedMapping().getPartName(), Fetch::getClass));
            final Map<String, Class<? extends Fetch>> expectedFetchClassByAttributeName = new HashMap<>();
            expectedFetchClassByAttributeName.put("homeAddress", EmbeddableFetchImpl.class);
            expectedFetchClassByAttributeName.put("pets", DelayedCollectionFetch.class);
            expectedFetchClassByAttributeName.put("company", EntityFetchJoinedImpl.class);
            assertThat(fetchClassByAttributeName, is(expectedFetchClassByAttributeName));
            Fetchable fetchable = getFetchable("company", Person.class);
            final Fetch companyFetch = ownerEntityResult.findFetch(fetchable);
            assertThat(companyFetch, notNullValue());
            final EntityResult companyEntityResult = ((EntityFetchJoinedImpl) companyFetch).getEntityResult();
            assertThat(companyEntityResult.getFetches(), hasSize(1));
            final Fetch shipAddressesFetch = companyEntityResult.getFetches().get(0);
            assertThat(shipAddressesFetch.getFetchedMapping().getPartName(), is("shipAddresses"));
            assertThat(shipAddressesFetch, instanceOf(DelayedCollectionFetch.class));
        });
    });
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Entity(jakarta.persistence.Entity) AssignableMatcher.assignableTo(org.hibernate.testing.hamcrest.AssignableMatcher.assignableTo) EntityPersister(org.hibernate.persister.entity.EntityPersister) GraphSemantic(org.hibernate.graph.GraphSemantic) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) EntityValuedModelPart(org.hibernate.metamodel.mapping.EntityValuedModelPart) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) Assert.assertThat(org.junit.Assert.assertThat) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) TestForIssue(org.hibernate.testing.TestForIssue) SessionFactoryScopeAware(org.hibernate.testing.orm.junit.SessionFactoryScopeAware) Map(java.util.Map) EntityResult(org.hibernate.sql.results.graph.entity.EntityResult) FetchType(jakarta.persistence.FetchType) Fetchable(org.hibernate.sql.results.graph.Fetchable) EntityDelayedFetchImpl(org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchImpl) LockOptions(org.hibernate.LockOptions) CollectionUtils(org.junit.platform.commons.util.CollectionUtils) LazyTableGroup(org.hibernate.sql.ast.tree.from.LazyTableGroup) Collection(java.util.Collection) DomainResult(org.hibernate.sql.results.graph.DomainResult) Set(java.util.Set) Id(jakarta.persistence.Id) DomainModel(org.hibernate.testing.orm.junit.DomainModel) Collectors(java.util.stream.Collectors) EmbeddableFetchImpl(org.hibernate.sql.results.graph.embeddable.internal.EmbeddableFetchImpl) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) Test(org.junit.jupiter.api.Test) LoadQueryInfluencers(org.hibernate.engine.spi.LoadQueryInfluencers) List(java.util.List) FromClause(org.hibernate.sql.ast.tree.from.FromClause) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) OneToMany(jakarta.persistence.OneToMany) ManyToOne(jakarta.persistence.ManyToOne) HashMap(java.util.HashMap) EnumSource(org.junit.jupiter.params.provider.EnumSource) Embedded(jakarta.persistence.Embedded) RootGraphImplementor(org.hibernate.graph.spi.RootGraphImplementor) CollectionMatchers.hasSize(org.hibernate.testing.hamcrest.CollectionMatchers.hasSize) LoaderSelectBuilder(org.hibernate.loader.ast.internal.LoaderSelectBuilder) Embeddable(jakarta.persistence.Embeddable) CollectionMatchers.isEmpty(org.hibernate.testing.hamcrest.CollectionMatchers.isEmpty) ElementCollection(jakarta.persistence.ElementCollection) Fetch(org.hibernate.sql.results.graph.Fetch) Consumer(java.util.function.Consumer) EntityFetch(org.hibernate.sql.results.graph.entity.EntityFetch) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) StandardVirtualTableGroup(org.hibernate.sql.ast.tree.from.StandardVirtualTableGroup) SessionFactoryScope(org.hibernate.testing.orm.junit.SessionFactoryScope) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping) SessionFactory(org.hibernate.testing.orm.junit.SessionFactory) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) EffectiveEntityGraph(org.hibernate.engine.spi.EffectiveEntityGraph) EntityFetchJoinedImpl(org.hibernate.sql.results.graph.entity.internal.EntityFetchJoinedImpl) EntityFetchJoinedImpl(org.hibernate.sql.results.graph.entity.internal.EntityFetchJoinedImpl) Fetchable(org.hibernate.sql.results.graph.Fetchable) LazyTableGroup(org.hibernate.sql.ast.tree.from.LazyTableGroup) StandardVirtualTableGroup(org.hibernate.sql.ast.tree.from.StandardVirtualTableGroup) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) HashMap(java.util.HashMap) EntityResult(org.hibernate.sql.results.graph.entity.EntityResult) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) Fetch(org.hibernate.sql.results.graph.Fetch) EntityFetch(org.hibernate.sql.results.graph.entity.EntityFetch) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with Fetchable

use of org.hibernate.sql.results.graph.Fetchable in project hibernate-orm by hibernate.

the class EntityGraphLoadPlanBuilderTest method getFetchable.

private Fetchable getFetchable(String attributeName, Class entityClass) {
    EntityPersister person = scope.getSessionFactory().getRuntimeMetamodels().getMappingMetamodel().findEntityDescriptor(entityClass.getName());
    Collection<AttributeMapping> attributeMappings = person.getAttributeMappings();
    Fetchable fetchable = null;
    for (AttributeMapping mapping : attributeMappings) {
        if (mapping.getAttributeName().equals(attributeName)) {
            fetchable = (Fetchable) mapping;
        }
    }
    return fetchable;
}
Also used : EntityPersister(org.hibernate.persister.entity.EntityPersister) Fetchable(org.hibernate.sql.results.graph.Fetchable) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping)

Example 5 with Fetchable

use of org.hibernate.sql.results.graph.Fetchable in project hibernate-orm by hibernate.

the class HqlEntityGraphTest method testFetchSemanticsWithDeepSubgraph.

@Test
void testFetchSemanticsWithDeepSubgraph() {
    scope.inTransaction(session -> {
        final RootGraphImplementor<Cat> eg = session.createEntityGraph(Cat.class);
        eg.addSubgraph("owner", Person.class).addSubgraph("company", ExpressCompany.class);
        final SelectStatement sqlAst = buildSqlSelectAst(Cat.class, "select c from Cat as c", eg, GraphSemantic.FETCH, session);
        // Check the from-clause
        assertEntityValuedJoinedGroup(sqlAst, "owner", Person.class, tableGroup -> {
            List<TableGroupJoin> tableGroupJoins = tableGroup.getTableGroupJoins();
            Map<String, Class<? extends TableGroup>> tableGroupByName = tableGroupJoins.stream().map(TableGroupJoin::getJoinedGroup).collect(Collectors.toMap(tg -> tg.getModelPart().getPartName(), TableGroup::getClass));
            Map<String, Class<? extends TableGroup>> expectedTableGroupByName = new HashMap<>();
            expectedTableGroupByName.put("homeAddress", StandardVirtualTableGroup.class);
            expectedTableGroupByName.put("company", LazyTableGroup.class);
            assertThat(tableGroupByName, is(expectedTableGroupByName));
        });
        // Check the domain-result graph
        assertDomainResult(sqlAst, Cat.class, "owner", Person.class, entityFetch -> {
            assertThat(entityFetch, instanceOf(EntityFetchJoinedImpl.class));
            final EntityResult ownerEntityResult = ((EntityFetchJoinedImpl) entityFetch).getEntityResult();
            final Map<String, Class<? extends Fetch>> fetchClassByAttributeName = ownerEntityResult.getFetches().stream().collect(Collectors.toMap(fetch -> fetch.getFetchedMapping().getPartName(), Fetch::getClass));
            final Map<String, Class<? extends Fetch>> expectedFetchClassByAttributeName = new HashMap<>();
            expectedFetchClassByAttributeName.put("homeAddress", EmbeddableFetchImpl.class);
            expectedFetchClassByAttributeName.put("pets", DelayedCollectionFetch.class);
            expectedFetchClassByAttributeName.put("company", EntityFetchJoinedImpl.class);
            assertThat(fetchClassByAttributeName, is(expectedFetchClassByAttributeName));
            Fetchable fetchable = getFetchable("company", Person.class);
            final Fetch companyFetch = ownerEntityResult.findFetch(fetchable);
            assertThat(companyFetch, notNullValue());
            final EntityResult companyEntityResult = ((EntityFetchJoinedImpl) companyFetch).getEntityResult();
            assertThat(companyEntityResult.getFetches(), hasSize(1));
            final Fetch shipAddressesFetch = companyEntityResult.getFetches().get(0);
            assertThat(shipAddressesFetch.getFetchedMapping().getPartName(), is("shipAddresses"));
            assertThat(shipAddressesFetch, instanceOf(DelayedCollectionFetch.class));
        });
    });
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Entity(jakarta.persistence.Entity) AssignableMatcher.assignableTo(org.hibernate.testing.hamcrest.AssignableMatcher.assignableTo) EntityPersister(org.hibernate.persister.entity.EntityPersister) GraphSemantic(org.hibernate.graph.GraphSemantic) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) EntityValuedModelPart(org.hibernate.metamodel.mapping.EntityValuedModelPart) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) Assert.assertThat(org.junit.Assert.assertThat) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) TestForIssue(org.hibernate.testing.TestForIssue) SqmQueryImplementor(org.hibernate.query.hql.spi.SqmQueryImplementor) SessionFactoryScopeAware(org.hibernate.testing.orm.junit.SessionFactoryScopeAware) Map(java.util.Map) EntityResult(org.hibernate.sql.results.graph.entity.EntityResult) FetchType(jakarta.persistence.FetchType) Fetchable(org.hibernate.sql.results.graph.Fetchable) EntityDelayedFetchImpl(org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchImpl) SqmSelectStatement(org.hibernate.query.sqm.tree.select.SqmSelectStatement) CollectionUtils(org.junit.platform.commons.util.CollectionUtils) LazyTableGroup(org.hibernate.sql.ast.tree.from.LazyTableGroup) Collection(java.util.Collection) DomainResult(org.hibernate.sql.results.graph.DomainResult) Set(java.util.Set) Id(jakarta.persistence.Id) DomainModel(org.hibernate.testing.orm.junit.DomainModel) QuerySqmImpl(org.hibernate.query.sqm.internal.QuerySqmImpl) Collectors(java.util.stream.Collectors) EmbeddableFetchImpl(org.hibernate.sql.results.graph.embeddable.internal.EmbeddableFetchImpl) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) Test(org.junit.jupiter.api.Test) LoadQueryInfluencers(org.hibernate.engine.spi.LoadQueryInfluencers) List(java.util.List) SessionImplementor(org.hibernate.engine.spi.SessionImplementor) FromClause(org.hibernate.sql.ast.tree.from.FromClause) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) OneToMany(jakarta.persistence.OneToMany) ManyToOne(jakarta.persistence.ManyToOne) HashMap(java.util.HashMap) EnumSource(org.junit.jupiter.params.provider.EnumSource) Embedded(jakarta.persistence.Embedded) RootGraphImplementor(org.hibernate.graph.spi.RootGraphImplementor) QueryImplementor(org.hibernate.query.spi.QueryImplementor) CollectionMatchers.hasSize(org.hibernate.testing.hamcrest.CollectionMatchers.hasSize) StandardSqmTranslator(org.hibernate.query.sqm.sql.internal.StandardSqmTranslator) Embeddable(jakarta.persistence.Embeddable) CollectionMatchers.isEmpty(org.hibernate.testing.hamcrest.CollectionMatchers.isEmpty) ElementCollection(jakarta.persistence.ElementCollection) SqmTranslation(org.hibernate.query.sqm.sql.SqmTranslation) Fetch(org.hibernate.sql.results.graph.Fetch) Consumer(java.util.function.Consumer) EntityFetch(org.hibernate.sql.results.graph.entity.EntityFetch) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) StandardVirtualTableGroup(org.hibernate.sql.ast.tree.from.StandardVirtualTableGroup) SessionFactoryScope(org.hibernate.testing.orm.junit.SessionFactoryScope) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping) SessionFactory(org.hibernate.testing.orm.junit.SessionFactory) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) EntityFetchJoinedImpl(org.hibernate.sql.results.graph.entity.internal.EntityFetchJoinedImpl) EntityFetchJoinedImpl(org.hibernate.sql.results.graph.entity.internal.EntityFetchJoinedImpl) Fetchable(org.hibernate.sql.results.graph.Fetchable) LazyTableGroup(org.hibernate.sql.ast.tree.from.LazyTableGroup) StandardVirtualTableGroup(org.hibernate.sql.ast.tree.from.StandardVirtualTableGroup) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) HashMap(java.util.HashMap) EntityResult(org.hibernate.sql.results.graph.entity.EntityResult) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) Fetch(org.hibernate.sql.results.graph.Fetch) EntityFetch(org.hibernate.sql.results.graph.entity.EntityFetch) SqmSelectStatement(org.hibernate.query.sqm.tree.select.SqmSelectStatement) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Fetchable (org.hibernate.sql.results.graph.Fetchable)10 AttributeMapping (org.hibernate.metamodel.mapping.AttributeMapping)8 PluralAttributeMapping (org.hibernate.metamodel.mapping.PluralAttributeMapping)8 EmbeddedAttributeMapping (org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping)8 Fetch (org.hibernate.sql.results.graph.Fetch)7 List (java.util.List)6 TableGroup (org.hibernate.sql.ast.tree.from.TableGroup)6 Map (java.util.Map)5 Consumer (java.util.function.Consumer)5 EntityValuedModelPart (org.hibernate.metamodel.mapping.EntityValuedModelPart)5 EntityPersister (org.hibernate.persister.entity.EntityPersister)5 HashMap (java.util.HashMap)4 ElementCollection (jakarta.persistence.ElementCollection)3 Embeddable (jakarta.persistence.Embeddable)3 Embedded (jakarta.persistence.Embedded)3 Entity (jakarta.persistence.Entity)3 FetchType (jakarta.persistence.FetchType)3 Id (jakarta.persistence.Id)3 ManyToOne (jakarta.persistence.ManyToOne)3 OneToMany (jakarta.persistence.OneToMany)3