use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.
the class BatchFetchStrategyHelperTest method testManyToOneJoinFetch.
@Test
public void testManyToOneJoinFetch() {
final AssociationType associationType = determineAssociationType(AnEntity.class, "otherEntityJoin");
final org.hibernate.FetchMode fetchMode = determineFetchMode(AnEntity.class, "otherEntityJoin");
assertSame(org.hibernate.FetchMode.JOIN, fetchMode);
final FetchStyle fetchStyle = FetchStrategyHelper.determineFetchStyleByMetadata(fetchMode, associationType, sessionFactory());
// batch size is ignored with org.hibernate.FetchMode.JOIN
assertSame(FetchStyle.JOIN, fetchStyle);
final FetchTiming fetchTiming = FetchStrategyHelper.determineFetchTiming(fetchStyle, associationType, sessionFactory());
assertSame(FetchTiming.IMMEDIATE, fetchTiming);
}
use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.
the class BatchFetchStrategyHelperTest method testCollectionSubselectFetch.
@Test
public void testCollectionSubselectFetch() {
final AssociationType associationType = determineAssociationType(AnEntity.class, "colorsSubselect");
final org.hibernate.FetchMode fetchMode = determineFetchMode(AnEntity.class, "colorsSubselect");
assertSame(org.hibernate.FetchMode.SELECT, fetchMode);
final FetchStyle fetchStyle = FetchStrategyHelper.determineFetchStyleByMetadata(fetchMode, associationType, sessionFactory());
// Batch size is ignored with FetchMode.SUBSELECT
assertSame(FetchStyle.SUBSELECT, fetchStyle);
final FetchTiming fetchTiming = FetchStrategyHelper.determineFetchTiming(fetchStyle, associationType, sessionFactory());
assertSame(FetchTiming.DELAYED, fetchTiming);
}
use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.
the class BatchFetchStrategyHelperTest 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.BATCH, fetchStyle);
final FetchTiming fetchTiming = FetchStrategyHelper.determineFetchTiming(fetchStyle, associationType, sessionFactory());
assertSame(FetchTiming.DELAYED, fetchTiming);
}
use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.
the class FetchStrategyHelperTest 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);
}
use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.
the class FetchStrategyHelperTest method testCollectionSelectFetch.
@Test
public void testCollectionSelectFetch() {
final AssociationType associationType = determineAssociationType(AnEntity.class, "colorsSelect");
final org.hibernate.FetchMode fetchMode = determineFetchMode(AnEntity.class, "colorsSelect");
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());
assertSame(FetchTiming.DELAYED, fetchTiming);
}
Aggregations