Best code examples for Hibernate ORM BootstrapServiceRegistryBuilder class (org.hibernate.boot.registry.BootstrapServiceRegistryBuilder)

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

Hibernate ORM BootstrapServiceRegistryBuilder examples from Open Source projects
This code example shows how to use the following methods:
			.setProperty("hibernate.connection.driver_class", org.h2.Driver.class.getName())
			.setProperty("hibernate.connection.url", "jdbc:h2:mem:test-loader")
			.setProperty("hibernate.connection.username", "sa")
			.setProperty("hibernate.connection.password", "");
		 
		BootstrapServiceRegistryBuilder bsrb = new BootstrapServiceRegistryBuilder().with(new Hibernate4ChangeSetIntegrator());
		StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder(bsrb.build()).applySettings(configuration.getProperties());
		ServiceRegistry serviceRegistry = ssrb.build();
		sessionFactory = configuration.buildSessionFactory(serviceRegistry);
	} 
	 
	@Override 
	protected void open() { 
		session = sessionFactory.openSession();
		tx = session.beginTransaction();
	} 
	@SuppressWarnings("unchecked") 
	@Override 
	protected <T> T find(Class<T> entityClass, Serializable id) {
		return (T)session.load(entityClass, id);
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods:
            .setProperty("hibernate.connection.driver_class", "org.h2.Driver")
            .setProperty("hibernate.connection.url", "jdbc:h2:mem:test-publish")
            .setProperty("hibernate.connection.username", "sa")
            .setProperty("hibernate.connection.password", "");
		 
		BootstrapServiceRegistryBuilder bsrb = new BootstrapServiceRegistryBuilder().with(new Hibernate4Integrator());
		StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder(bsrb.build()).applySettings(configuration.getProperties());
		ServiceRegistry serviceRegistry = ssrb.build();
		sessionFactory = configuration.buildSessionFactory(serviceRegistry);
	} 
	 
	protected void open() { 
		Method m;
		try { 
			m = sessionFactory.getClass().getMethod("openSession");
			session = (Session)m.invoke(sessionFactory);
		}  
		catch (Exception e) {
			throw new RuntimeException("Could not open session", e);
		} 
Full Snippet Info
5
CodeRank