Package com.jverstry.RetrievingHibernateSession

Source Code of com.jverstry.RetrievingHibernateSession.RetrievingHibernateSessionExample

package com.jverstry.RetrievingHibernateSession;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

public class RetrievingHibernateSessionExample {

  private static EntityManagerFactory EMF;
  private static EntityManager EM;
 
  public static void main(String[] args) {

    // Creating resources
    EMF = Persistence.createEntityManagerFactory("Standalone");
    EM = EMF.createEntityManager();
   
    Object o = EM.getDelegate();
    System.out.println(o.getClass());
   
    Session s = (Session) o;
   
    SessionFactory sf = s.getSessionFactory();
   
  }
 
}
TOP

Related Classes of com.jverstry.RetrievingHibernateSession.RetrievingHibernateSessionExample

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.