Package org.hibernate

Examples of org.hibernate.SessionFactory.openSession()


  private static Session createSession()
  {
    SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
   
    return sessionFactory.openSession();
  }

}
View Full Code Here


    // open the hibernate-session
    Session session = null;
    if (connectionName!=null) {
      Connection connection = (Connection) wireContext.get(connectionName);
      log.finest("creating hibernate session with connection "+connection);
      session = sessionFactory.openSession(connection);

    } else {
      log.finest("creating hibernate session");
      session = sessionFactory.openSession();
    }
View Full Code Here

      log.finest("creating hibernate session with connection "+connection);
      session = sessionFactory.openSession(connection);

    } else {
      log.finest("creating hibernate session");
      session = sessionFactory.openSession();
    }

    return session;
  }
View Full Code Here

    final EntityManagerFactory emf = Persistence.createEntityManagerFactory( "jpajtastandalone", TestHelper.getEnvironmentProperties() );
    assertThat( HibernateEntityManagerFactory.class.isAssignableFrom( emf.getClass() ) ).isTrue();
    SessionFactory factory = ( (HibernateEntityManagerFactory) emf ).getSessionFactory();
    assertThat( factory.getClass() ).isEqualTo( OgmSessionFactoryImpl.class );

    Session s = factory.openSession();
    assertThat( s.getClass() ).isEqualTo( OgmSessionImpl.class );
    assertThat( s.getSessionFactory().getClass() ).isEqualTo( OgmSessionFactoryImpl.class );
    s.close();

    EntityManager em = emf.createEntityManager();
View Full Code Here

    session.getNamedQuery("");
    sCtrl.setMatcher(MockControl.ALWAYS_MATCHER);
    sCtrl.setReturnValue(query);

    sfCtrl.expectAndReturn(sf.openSession(), session);
    sfCtrl.replay();
    sCtrl.replay();
    queryCtrl.replay();

    configuration.setProcessDefinitions(new ProcessDefinition[] { (ProcessDefinition) definition.getObject() });
View Full Code Here

    SessionFactory sessionFactory = null;
    Session session = null;

    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
     
      performDBAction(objToSave, criteria, session);

    } catch (Exception a_th) {
      throw new RuntimeException(a_th);
View Full Code Here

    SessionFactory sessionFactory = null;
    Session session = null;
    RightsGroup group = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Criteria c = session.createCriteria(RightsGroup.class);
      c.add(Restrictions.eq("groupName", groupName));
      List<RightsGroup> lstRights = c.list();
      if(lstRights != null && lstRights.size() > 0) {
        group = lstRights.get(0);
View Full Code Here

    SessionFactory sessionFactory = null;
    Session session = null;
    RightsGroup group = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Criteria c = session.createCriteria(RightsGroup.class);
      c.add(Restrictions.idEq(groupID));
      List<RightsGroup> lstRights = c.list();
      if(lstRights != null && lstRights.size() > 0) {
        group = lstRights.get(0);
View Full Code Here

    SessionFactory sessionFactory = null;
    Session session = null;
    BaseRight baseRight = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Criteria c = session.createCriteria(BaseRight.class);
      c.add(Restrictions.idEq(baseRightID));
      List<BaseRight> lstRights = c.list();
      if(lstRights != null && lstRights.size() > 0) {
        baseRight = lstRights.get(0);
View Full Code Here

  public List<AssignedRightsGroup> getAllAssociatedGroups(IPermisibleResource resource, RightsGroup group) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Criteria c = session.createCriteria(AssignedRightsGroup.class);
      if(resource != null) {
        c.add(Restrictions.eq("resourceTypeID", resource.getResourceTypeID()))
      }
     
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.