Best code examples for Hibernate ORM Configuration class (org.hibernate.cfg.Configuration)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM Configuration class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Hibernate ORM Configuration examples from Open Source projects
This code example shows how to use the following methods:
		} 
		return cfg;
	} 
 
	protected Configuration createConfiguration() {
		return new Configuration();
	} 
	 
	/** 
	 *  
	 */ 
	protected void doConfiguration(Configuration configuration) {	
		validateParameters();		 
		 
		if (entityResolver != null) {
			try { 
				Class resolver = ReflectHelper.classForName(entityResolver, this.getClass());
				Object object = resolver.newInstance();
				 
				configuration.setEntityResolver((EntityResolver) object);
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: buildSessionFactory, configure, setProperty
	public static final Logger logger = Logger.getLogger(CloudSessionFactory.class);
	 
	private SessionFactory factory;
	 
	private CloudSessionFactory() { 
		Configuration cfg = new Configuration();
		File file = ConfigurationHelper.findConfigurationFile("hibernate.cfg.xml");
 
        File propertiesFile = ConfigurationHelper.findConfigurationFile("db.properties");
        Properties dbProp = null;
        String     dbName     = null;
        String     dbHost     = null;
        String     dbUser     = null;
        String     dbPassword = null;
        String     dbPort     = null; 
                
        if (null != propertiesFile) {
             
            if(EncryptionSecretKeyCheckerUtil.useEncryption()){ 
                StandardPBEStringEncryptor encryptor = EncryptionSecretKeyCheckerUtil.getEncryptor();

8
CodeRank
This code example shows how to use the following methods:
			throw new IOException(e);
		} 
	} 
	 
	public SessionFactory buildSessionFactory() {
		Configuration config = new Configuration().configure();
		//H2 version we use behaves differently from H2Dialect in Hibernate so we provide our implementation 
		config.setProperty(Environment.DIALECT, H2LessStrictDialect.class.getName());
		config.setProperty(Environment.URL, connectionUrl);
		config.setProperty(Environment.DRIVER, "org.h2.Driver");
		config.setProperty(Environment.USER, "sa");
		config.setProperty(Environment.PASS, "sa");
		config.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "false");
		config.setProperty(Environment.USE_QUERY_CACHE, "false");
		 
		//Let's validate HBMs against the actual schema 
		config.setProperty(Environment.HBM2DDL_AUTO, "validate");
		 
		return config.buildSessionFactory();
	} 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: buildSessionFactory, configure, setProperty
	public static final Logger logger = Logger.getLogger(CloudStackSessionFactory.class);
	 
	private SessionFactory factory;
	 
	private CloudStackSessionFactory() { 
		Configuration cfg = new Configuration();
		File file = ConfigurationHelper.findConfigurationFile("CloudStack.cfg.xml");
 
        File propertiesFile = ConfigurationHelper.findConfigurationFile("db.properties");
        Properties dbProp = null;
        String     dbName     = null;
        String     dbHost     = null;
        String     dbUser     = null;
        String     dbPassword = null;
        String     dbPort     = null; 
                
        if (null != propertiesFile) {
             
            if(EncryptionSecretKeyCheckerUtil.useEncryption()){ 
                StandardPBEStringEncryptor encryptor = EncryptionSecretKeyCheckerUtil.getEncryptor();

8
CodeRank
This code example shows how to use the following methods: buildSessionFactory, configure
		return sessionFactory.getCurrentSession();
	} 
 
	private HibernateUtil() { 
		try { 
			Configuration configuration = new Configuration();
 
			configuration = configuration.configure();
 
			_sessionFactory = configuration.buildSessionFactory();
		} 
		catch (Exception e) {
			_log.error(e, e);
		} 
	} 
 
	private static Log _log = LogFactoryUtil.getLog(HibernateUtil.class);
 
	private static HibernateUtil _instance = new HibernateUtil();
 
Full Snippet Info
7
CodeRank
See Code Examples for Hibernate ORM Configuration Methods: