Search in sources :

Example 1 with SingleIdEntityLoader

use of org.hibernate.loader.ast.spi.SingleIdEntityLoader in project hibernate-orm by hibernate.

the class LoadingSmokeTests method testBasicGet.

@Test
public void testBasicGet(SessionFactoryScope scope) {
    scope.inTransaction(session -> {
        final BasicEntity gotten = session.byId(BasicEntity.class).load(1);
        assertThat(gotten, notNullValue());
        assertThat(Hibernate.isInitialized(gotten), is(true));
        assertThat(gotten.getId(), is(1));
        assertThat(gotten.getData(), is("first"));
        final AbstractEntityPersister entityDescriptor = (AbstractEntityPersister) session.getSessionFactory().getRuntimeMetamodels().getMappingMetamodel().getEntityDescriptor(BasicEntity.class);
        final SingleIdEntityLoader singleIdEntityLoader = entityDescriptor.getSingleIdEntityLoader();
        assertThat(singleIdEntityLoader, instanceOf(SingleIdEntityLoaderStandardImpl.class));
        assertThat(((SingleIdEntityLoaderStandardImpl) singleIdEntityLoader).getNonReusablePlansGenerated().get(), is(0));
    });
}
Also used : SingleIdEntityLoader(org.hibernate.loader.ast.spi.SingleIdEntityLoader) SingleIdEntityLoaderStandardImpl(org.hibernate.loader.ast.internal.SingleIdEntityLoaderStandardImpl) AbstractEntityPersister(org.hibernate.persister.entity.AbstractEntityPersister) BasicEntity(org.hibernate.testing.orm.domain.gambit.BasicEntity) Test(org.junit.jupiter.api.Test)

Aggregations

SingleIdEntityLoaderStandardImpl (org.hibernate.loader.ast.internal.SingleIdEntityLoaderStandardImpl)1 SingleIdEntityLoader (org.hibernate.loader.ast.spi.SingleIdEntityLoader)1 AbstractEntityPersister (org.hibernate.persister.entity.AbstractEntityPersister)1 BasicEntity (org.hibernate.testing.orm.domain.gambit.BasicEntity)1 Test (org.junit.jupiter.api.Test)1