Hibernate ORM BootstrapServiceRegistryBuilder - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM BootstrapServiceRegistryBuilder class.

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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java