Package org.hibernate

Examples of org.hibernate.SessionFactory.openSession()


    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    final MockControl sessionControl = MockControl.createControl(Session.class);
    final Session session = (Session) sessionControl.getMock();
    sf.openSession();
    sfControl.setReturnValue(session, 1);
    session.getSessionFactory();
    sessionControl.setReturnValue(sf, 1);
    sfControl.replay();
    sessionControl.replay();
View Full Code Here


      utControl.setReturnValue(Status.STATUS_ACTIVE, 2);
      ut.commit();
    }
    utControl.setVoidCallable(2);

    sf.openSession();
    sfControl.setReturnValue(session1, 1);
    sf.openSession();
    sfControl.setReturnValue(session2, 1);
    session1.getSessionFactory();
    session1Control.setReturnValue(sf, 1);
View Full Code Here

    }
    utControl.setVoidCallable(2);

    sf.openSession();
    sfControl.setReturnValue(session1, 1);
    sf.openSession();
    sfControl.setReturnValue(session2, 1);
    session1.getSessionFactory();
    session1Control.setReturnValue(sf, 1);
    session2.getSessionFactory();
    session2Control.setReturnValue(sf, 1);
View Full Code Here

      tmControl.setVoidCallable(1);
    }
    ut.rollback();
    utControl.setVoidCallable(1);

    sf.openSession();
    sfControl.setReturnValue(session1, 1);
    session1.getSessionFactory();
    session1Control.setReturnValue(sf, 1);
    session1.disconnect();
    session1Control.setReturnValue(null, 1);
View Full Code Here

    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(Session.class);
    final Session session = (Session) sessionControl.getMock();

    sf.openSession();
    sfControl.setReturnValue(session, 1);
    session.getSessionFactory();
    sessionControl.setReturnValue(sf, 1);
    session.getFlushMode();
    sessionControl.setReturnValue(FlushMode.NEVER, 1);
View Full Code Here

    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(Session.class);
    final Session session = (Session) sessionControl.getMock();

    sf.openSession();
    sfControl.setReturnValue(session, 1);
    session.getSessionFactory();
    sessionControl.setReturnValue(sf, 1);
    session.isOpen();
    sessionControl.setReturnValue(true, 1);
View Full Code Here

    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    final MockControl sessionControl = MockControl.createControl(Session.class);
    final Session session = (Session) sessionControl.getMock();
    MockControl sfiControl = MockControl.createControl(SessionFactoryImplementor.class);
    final SessionFactoryImplementor sfi = (SessionFactoryImplementor) sfiControl.getMock();
    sf.openSession();
    sfControl.setReturnValue(session, 1);
    session.getSessionFactory();
    sessionControl.setReturnValue(sfi, 6);
    sfi.getTransactionManager();
    sfiControl.setReturnValue(tm, 6);
View Full Code Here

    * <pre>sf.openSession( sf.getCurrentSession().connection() )</pre>
    */
   public static Session getUnmanagedSession(String name) throws HibernateException, IllegalStateException
   {
      SessionFactory sf = locateSessionFactory( name );
      return sf.openSession( sf.getCurrentSession().connection() );
   }

   /**
    * Method to release a previously obtained unmanaged session.
    *
 
View Full Code Here

      log.debug("Full Hibernate Plugin's Session Factory property file \"/"+fileProperties+"\" configured");
    }
   
    SessionFactory sessionFactory = configuration.buildSessionFactory();
   
    Session testSession = sessionFactory.openSession();
    testSession.connection().getMetaData().getCatalogs();
    testSession.close();
    return sessionFactory;
  }
View Full Code Here

    SessionFactory sf = getSessions();
    Statistics stats = sf.getStatistics();
    boolean isStats = stats.isStatisticsEnabled();
    stats.clear();
    stats.setStatisticsEnabled(true);
    Session s = sf.openSession();
    assertEquals( 1, stats.getSessionOpenCount() );
    s.close();
    assertEquals( 1, stats.getSessionCloseCount() );
    s = sf.openSession();
    Transaction tx = s.beginTransaction();
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.