use of org.hibernate.type.AssociationType 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);
}
use of org.hibernate.type.AssociationType in project hibernate-orm by hibernate.
the class FetchStrategyHelperTest method determineAssociationType.
private AssociationType determineAssociationType(Class<?> entityClass, String path) {
OuterJoinLoadable entityPersister = (OuterJoinLoadable) sessionFactory().getEntityPersister(entityClass.getName());
int index = ((UniqueKeyLoadable) entityPersister).getPropertyIndex(path);
return (AssociationType) entityPersister.getSubclassPropertyType(index);
}
use of org.hibernate.type.AssociationType in project hibernate-orm by hibernate.
the class FetchStrategyHelperTest method testCollectionJoinFetch.
@Test
public void testCollectionJoinFetch() {
final AssociationType associationType = determineAssociationType(AnEntity.class, "colorsJoin");
final org.hibernate.FetchMode fetchMode = determineFetchMode(AnEntity.class, "colorsJoin");
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.type.AssociationType in project hibernate-orm by hibernate.
the class NoProxyFetchStrategyHelperTest 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());
assertSame(FetchStyle.JOIN, fetchStyle);
final FetchTiming fetchTiming = FetchStrategyHelper.determineFetchTiming(fetchStyle, associationType, sessionFactory());
assertSame(FetchTiming.IMMEDIATE, fetchTiming);
}
use of org.hibernate.type.AssociationType in project hibernate-orm by hibernate.
the class BatchFetchStrategyHelperTest method testCollectionDefaultFetch.
@Test
public void testCollectionDefaultFetch() {
final AssociationType associationType = determineAssociationType(AnEntity.class, "colorsDefault");
final org.hibernate.FetchMode fetchMode = determineFetchMode(AnEntity.class, "colorsDefault");
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);
}
Aggregations