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));
});
}
Aggregations