Created
November 24, 2015 20:39
-
-
Save Guvenir/b7c16b23aeddcae2220d to your computer and use it in GitHub Desktop.
Hibernate SessionFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.hibernate.SessionFactory; | |
import org.hibernate.boot.MetadataSources; | |
import org.hibernate.boot.registry.StandardServiceRegistry; | |
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; | |
public class SesFactory { | |
public static SessionFactory getSessionFactory(){ | |
final StandardServiceRegistry registry = new StandardServiceRegistryBuilder() | |
.configure() // configures settings from hibernate.cfg.xml | |
.build(); | |
return new MetadataSources(registry).buildMetadata().buildSessionFactory(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment