use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.
the class NoProxyFetchStrategyHelperTest method testManyToOneSelectFetch.
@Test
public void testManyToOneSelectFetch() {
final AssociationType associationType = determineAssociationType(AnEntity.class, "otherEntitySelect");
final org.hibernate.FetchMode fetchMode = determineFetchMode(AnEntity.class, "otherEntitySelect");
assertSame(org.hibernate.FetchMode.SELECT, fetchMode);
final FetchStyle fetchStyle = FetchStrategyHelper.determineFetchStyleByMetadata(fetchMode, associationType, sessionFactory());
assertSame(FetchStyle.SELECT, fetchStyle);
final FetchTiming fetchTiming = FetchStrategyHelper.determineFetchTiming(fetchStyle, associationType, sessionFactory());
// Proxies are not allowed, so it should be FetchTiming.IMMEDIATE
assertSame(FetchTiming.IMMEDIATE, fetchTiming);
}
use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.
the class NoProxyFetchStrategyHelperTest method testManyToOneDefaultFetch.
@Test
public void testManyToOneDefaultFetch() {
final AssociationType associationType = determineAssociationType(AnEntity.class, "otherEntityDefault");
final org.hibernate.FetchMode fetchMode = determineFetchMode(AnEntity.class, "otherEntityDefault");
assertSame(org.hibernate.FetchMode.JOIN, fetchMode);
final FetchStyle fetchStyle = FetchStrategyHelper.determineFetchStyleByMetadata(fetchMode, associationType, sessionFactory());
assertSame(FetchStyle.JOIN, fetchStyle);
final FetchTiming fetchTiming = FetchStrategyHelper.determineFetchTiming(fetchStyle, associationType, sessionFactory());
assertSame(FetchTiming.IMMEDIATE, fetchTiming);
}
Aggregations