Examples of enableFetchProfile()


Examples of org.hibernate.Session.enableFetchProfile()

    assertTrue( "fetch profile not parsed properly", sfi().containsFetchProfileDefinition( "enrollment.details" ) );
    assertTrue( "fetch profile not parsed properly", sfi().containsFetchProfileDefinition( "offering.details" ) );
    assertTrue( "fetch profile not parsed properly", sfi().containsFetchProfileDefinition( "course.details" ) );
    Session s = openSession();
    SessionImplementor si = ( SessionImplementor ) s;
    s.enableFetchProfile( "enrollment.details" );
    assertTrue( si.getLoadQueryInfluencers().hasEnabledFetchProfiles() );
    s.disableFetchProfile( "enrollment.details" );
    assertFalse( si.getLoadQueryInfluencers().hasEnabledFetchProfiles() );
    try {
      s.enableFetchProfile( "never-gonna-get-it" );
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

    s.enableFetchProfile( "enrollment.details" );
    assertTrue( si.getLoadQueryInfluencers().hasEnabledFetchProfiles() );
    s.disableFetchProfile( "enrollment.details" );
    assertFalse( si.getLoadQueryInfluencers().hasEnabledFetchProfiles() );
    try {
      s.enableFetchProfile( "never-gonna-get-it" );
      fail( "expecting failure on undefined fetch-profile" );
    }
    catch ( UnknownProfileException expected ) {
    }
    s.close();
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

    performWithStandardData(
        new TestCode() {
          public void perform(TestData data) {
            Session session = openSession();
            session.beginTransaction();
            session.enableFetchProfile( "enrollment.details" );
            Enrollment enrollment = ( Enrollment ) session.get( Enrollment.class, data.getEnrollmentId() );
            assertEquals( 3, sfi().getStatistics().getEntityLoadCount() ); // enrollment + (section + student)
            assertEquals( 0, sfi().getStatistics().getEntityFetchCount() );
            assertTrue( Hibernate.isInitialized( enrollment.getOffering() ) );
            assertTrue( Hibernate.isInitialized( enrollment.getStudent() ) );
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

    performWithStandardData(
        new TestCode() {
          public void perform(TestData data) {
            Session session = openSession();
            session.beginTransaction();
            session.enableFetchProfile( "enrollment.details" );
            Enrollment enrollment = ( Enrollment ) session.createCriteria( Enrollment.class ).uniqueResult();
            assertEquals( 3, sfi().getStatistics().getEntityLoadCount() ); // enrollment + (section + student)
            assertEquals( 0, sfi().getStatistics().getEntityFetchCount() );
            assertTrue( Hibernate.isInitialized( enrollment.getOffering() ) );
            assertTrue( Hibernate.isInitialized( enrollment.getStudent() ) );
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

    performWithStandardData(
        new TestCode() {
          public void perform(TestData data) {
            Session session = openSession();
            session.beginTransaction();
            session.enableFetchProfile( "offering.details" );
            CourseOffering section = ( CourseOffering ) session.get( CourseOffering.class, data.getSectionId() );
            assertEquals( 3, sfi().getStatistics().getEntityLoadCount() ); // section + (enrollments + course)
            assertEquals( 0, sfi().getStatistics().getEntityFetchCount() );
            assertTrue( Hibernate.isInitialized( section.getEnrollments() ) );
            session.getTransaction().commit();
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

            Session session = openSession();
            session.beginTransaction();
            // enable both enrollment and offering detail profiles;
            // then loading the section/offering should fetch the enrollment
            // which in turn should fetch student (+ offering).
            session.enableFetchProfile( "offering.details" );
            session.enableFetchProfile( "enrollment.details" );
            CourseOffering section = ( CourseOffering ) session.get( CourseOffering.class, data.getSectionId() );
            assertEquals( 4, sfi().getStatistics().getEntityLoadCount() ); // section + (course + enrollments + (student))
            assertEquals( 0, sfi().getStatistics().getEntityFetchCount() );
            assertTrue( Hibernate.isInitialized( section.getEnrollments() ) );
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

            session.beginTransaction();
            // enable both enrollment and offering detail profiles;
            // then loading the section/offering should fetch the enrollment
            // which in turn should fetch student (+ offering).
            session.enableFetchProfile( "offering.details" );
            session.enableFetchProfile( "enrollment.details" );
            CourseOffering section = ( CourseOffering ) session.get( CourseOffering.class, data.getSectionId() );
            assertEquals( 4, sfi().getStatistics().getEntityLoadCount() ); // section + (course + enrollments + (student))
            assertEquals( 0, sfi().getStatistics().getEntityFetchCount() );
            assertTrue( Hibernate.isInitialized( section.getEnrollments() ) );
            session.getTransaction().commit();
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

    performWithStandardData(
        new TestCode() {
          public void perform(TestData data) {
            Session session = openSession();
            session.beginTransaction();
            session.enableFetchProfile( "course.details" );
            Course course = ( Course ) session.get( Course.class, data.getCourseId() );
            assertEquals( 2, sfi().getStatistics().getEntityLoadCount() ); // course + department
            assertEquals( 0, sfi().getStatistics().getEntityFetchCount() );
            assertTrue( Hibernate.isInitialized( course.getCode().getDepartment() ) );
            session.getTransaction().commit();
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

    performWithStandardData(
        new TestCode() {
          public void perform(TestData data) {
            Session session = openSession();
            session.beginTransaction();
            session.enableFetchProfile( "offering.details" );
            session.enableFetchProfile( "enrollment.details" );
            List sections = session.createQuery( "from CourseOffering" ).list();
            int sectionCount = sections.size();
            assertEquals( "unexpected CourseOffering count", 1, sectionCount );
            assertEquals( 1, sfi().getStatistics().getEntityLoadCount() );
View Full Code Here

Examples of org.hibernate.Session.enableFetchProfile()

        new TestCode() {
          public void perform(TestData data) {
            Session session = openSession();
            session.beginTransaction();
            session.enableFetchProfile( "offering.details" );
            session.enableFetchProfile( "enrollment.details" );
            List sections = session.createQuery( "from CourseOffering" ).list();
            int sectionCount = sections.size();
            assertEquals( "unexpected CourseOffering count", 1, sectionCount );
            assertEquals( 1, sfi().getStatistics().getEntityLoadCount() );
            assertEquals( 0, sfi().getStatistics().getEntityFetchCount() );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.