Search in sources :

Example 6 with FetchTiming

use of org.hibernate.engine.FetchTiming 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);
}
Also used : FetchStyle(org.hibernate.engine.FetchStyle) AssociationType(org.hibernate.type.AssociationType) FetchTiming(org.hibernate.engine.FetchTiming) Test(org.junit.Test)

Example 7 with FetchTiming

use of org.hibernate.engine.FetchTiming 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);
}
Also used : FetchStyle(org.hibernate.engine.FetchStyle) AssociationType(org.hibernate.type.AssociationType) FetchTiming(org.hibernate.engine.FetchTiming) Test(org.junit.Test)

Example 8 with FetchTiming

use of org.hibernate.engine.FetchTiming 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);
}
Also used : FetchStyle(org.hibernate.engine.FetchStyle) AssociationType(org.hibernate.type.AssociationType) FetchTiming(org.hibernate.engine.FetchTiming) Test(org.junit.Test)

Example 9 with FetchTiming

use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.

the class BatchFetchStrategyHelperTest 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());
    // 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);
}
Also used : FetchStyle(org.hibernate.engine.FetchStyle) AssociationType(org.hibernate.type.AssociationType) FetchTiming(org.hibernate.engine.FetchTiming) Test(org.junit.Test)

Example 10 with FetchTiming

use of org.hibernate.engine.FetchTiming in project hibernate-orm by hibernate.

the class BatchFetchStrategyHelperTest 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());
    // 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);
}
Also used : FetchStyle(org.hibernate.engine.FetchStyle) AssociationType(org.hibernate.type.AssociationType) FetchTiming(org.hibernate.engine.FetchTiming) Test(org.junit.Test)

Aggregations

FetchStyle (org.hibernate.engine.FetchStyle)17 FetchTiming (org.hibernate.engine.FetchTiming)17 AssociationType (org.hibernate.type.AssociationType)17 Test (org.junit.Test)17