Hibernate ORM JdbcServices - 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 JdbcServices class.

This code example shows how to use the following methods:getConnectionProvider, getSqlStatementLogger
     
    private Statement stmt;
 
    public DbOpenHelper(ServiceRegistry serviceRegistry) throws HibernateException {
        final JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
        connectionHelper = new SuppliedConnectionProviderConnectionHelper(jdbcServices.getConnectionProvider());
 
        sqlStatementLogger = jdbcServices.getSqlStatementLogger();
        formatter = (sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE).getFormatter();
    } 
 
    public void open() { 
        log.info("Opening database and executing incremental updates"); 
 
        Connection connection = null;
        Writer outputFileWriter = null;
 
        exceptions.clear();
 
        try { 
6
CodeRank
This code example shows how to use the following methods:getConnectionProvider, getDialect, getSqlStatementLogger
 
	public SchemaUpdate(ServiceRegistry serviceRegistry, Configuration cfg) throws HibernateException { 
		this.configuration = cfg; 
 
		final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); 
		this.dialect = jdbcServices.getDialect(); 
		this.connectionHelper = new SuppliedConnectionProviderConnectionHelper( jdbcServices.getConnectionProvider() ); 
 
		this.sqlExceptionHelper = new SqlExceptionHelper(); 
		this.sqlStatementLogger = jdbcServices.getSqlStatementLogger(); 
		this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter(); 
	} 
 
	private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) { 
		Environment.verifyProperties( properties ); 
		ConfigurationHelper.resolvePlaceHolders( properties ); 
		return (StandardServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry(); 
	} 
 
	public static void main(String[] args) { 
5
CodeRank
This code example shows how to use the following methods:getConnectionProvider, getDialect
	} 
 
	public SchemaValidator(ServiceRegistry serviceRegistry, Configuration cfg ) throws HibernateException { 
		this.configuration = cfg; 
		final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); 
		this.dialect = jdbcServices.getDialect(); 
		this.connectionHelper = new SuppliedConnectionProviderConnectionHelper( jdbcServices.getConnectionProvider() ); 
	} 
 
	private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) { 
		Environment.verifyProperties( properties ); 
		ConfigurationHelper.resolvePlaceHolders( properties ); 
		return (StandardServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry(); 
	} 
 
	public static void main(String[] args) { 
		try { 
			Configuration cfg = new Configuration(); 
 
			String propFile = null; 
5
CodeRank
This code example shows how to use the following methods:getSqlStatementLogger
				.getServiceRegistry() 
				.getService( JdbcServices.class ) 
				.getSqlStatementLogger(); 
		return session.getTransactionCoordinator().getTransaction().createIsolationDelegate().delegateWork( 
				new AbstractReturningWork<IntegralDataTypeHolder>() { 
					@Override 
					public IntegralDataTypeHolder execute(Connection connection) throws SQLException { 
						IntegralDataTypeHolder value = buildHolder(); 
						int rows; 
						do { 
							// The loop ensures atomicity of the 
							// select + update even for no transaction 
							// or read committed isolation level 
 
							statementLogger.logStatement( query, FormatStyle.BASIC.getFormatter() ); 
							PreparedStatement qps = connection.prepareStatement( query ); 
							try { 
								ResultSet rs = qps.executeQuery(); 
								if ( !rs.next() ) { 
									String err = "could not read a hi value - you need to populate the table: " + tableName; 
4
CodeRank
This code example shows how to use the following methods:getDialect
		} 
		return generatorClass; 
	} 
 
	@Override 
	public void injectServices(ServiceRegistryImplementor serviceRegistry) { 
		this.dialect = serviceRegistry.getService( JdbcServices.class ).getDialect(); 
	} 
} 
4
CodeRank
See Code Examples for Hibernate ORM JdbcServices Methods: