public InlineIdsIdsInClauseDeleteHandlerImpl( SessionFactoryImplementor factory, HqlSqlWalker walker) { super( factory, walker ); Dialect dialect = factory.getServiceRegistry().getService( JdbcServices.class ).getDialect(); if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!" ); } }
@Override public void registerRefCursorParameter(CallableStatement statement, String name) { if ( jdbcServices.getExtractedMetaDataSupport().supportsRefCursors() ) { try { statement.registerOutParameter( name, refCursorTypeCode() ); } catch (SQLException e) { throw jdbcServices.getSqlExceptionHelper().convert( e, "Error registering REF_CURSOR parameter [" + name + "]" ); } } else { try { jdbcServices.getDialect().registerResultSetOutParameter( statement, name ); } catch (SQLException e) { throw jdbcServices.getSqlExceptionHelper().convert( e, "Error asking dialect to register ref cursor parameter [" + name + "]" ); } } }
/** * Constructs a ResultSetReturnImpl * * @param jdbcCoordinator The JdbcCoordinator */ public ResultSetReturnImpl(JdbcCoordinator jdbcCoordinator) { this.jdbcCoordinator = jdbcCoordinator; final JdbcServices jdbcServices = jdbcCoordinator.getJdbcSessionOwner() .getJdbcSessionContext() .getServiceRegistry() .getService( JdbcServices.class ); this.dialect = jdbcServices.getDialect(); this.sqlStatementLogger = jdbcServices.getSqlStatementLogger(); this.sqlExceptionHelper = jdbcServices.getSqlExceptionHelper(); }
public JdbcContextBuilder(ServiceRegistry serviceRegistry) { this.serviceRegistry = serviceRegistry; final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); this.sqlStatementLogger = jdbcServices.getSqlStatementLogger(); this.sqlExceptionHelper = jdbcServices.getSqlExceptionHelper(); this.dialect = jdbcServices.getJdbcEnvironment().getDialect(); this.jdbcConnectionAccess = jdbcServices.getBootstrapJdbcConnectionAccess(); }
@Override public SqlExceptionHelper getSqlExceptionHelper() { return jdbcServices.getSqlExceptionHelper(); }
@Override public SqlStatementLogger getSqlStatementLogger() { return jdbcServices.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(); }
@Override public Dialect getDialect() { return jdbcServices.getJdbcEnvironment().getDialect(); }
protected AbstractBatchImpl(BatchKey key, JdbcCoordinator jdbcCoordinator) { if ( key == null ) { throw new IllegalArgumentException( "batch key cannot be null" ); } if ( jdbcCoordinator == null ) { throw new IllegalArgumentException( "JDBC coordinator cannot be null" ); } this.key = key; this.jdbcCoordinator = jdbcCoordinator; final JdbcServices jdbcServices = jdbcCoordinator.getJdbcSessionOwner() .getJdbcSessionContext() .getServiceRegistry() .getService( JdbcServices.class ); this.sqlStatementLogger = jdbcServices.getSqlStatementLogger(); this.sqlExceptionHelper = jdbcServices.getSqlExceptionHelper(); }
public AbstractCteValuesListBulkIdHandler( SessionFactoryImplementor sessionFactory, HqlSqlWalker walker, String catalog, String schema) { super( sessionFactory, walker ); Dialect dialect = sessionFactory.getServiceRegistry().getService( JdbcServices.class ).getDialect(); if ( !dialect.supportsNonQueryWithCTE() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support CTE that can take UPDATE or DELETE statements as well!" ); } if ( !dialect.supportsValuesList() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support VALUES lists!" ); } if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!" ); } this.jdbcEnvironment = sessionFactory.getServiceRegistry().getService( JdbcServices.class ).getJdbcEnvironment(); this.catalog = catalog; this.schema = schema; }
public JdbcContextDelayedDropImpl(ServiceRegistry serviceRegistry) { this.serviceRegistry = serviceRegistry; this.jdbcServices = serviceRegistry.getService( JdbcServices.class ); this.jdbcConnectionAccess = jdbcServices.getBootstrapJdbcConnectionAccess(); if ( jdbcConnectionAccess == null ) { // todo : log or error? throw new SchemaManagementException( "Could not build JDBC Connection context to drop schema on SessionFactory close" ); } }
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(); }
configurationSettings.putAll( jdbcServices.getJdbcEnvironment().getDialect().getDefaultProperties() ); MultiTableBulkIdStrategy.class, configurationSettings.get( HQL_BULK_ID_STRATEGY ), jdbcServices.getJdbcEnvironment().getDialect().getDefaultMultiTableBulkIdStrategy() ); final ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();
@Override public SqlExceptionHelper getSqlExceptionHelper() { return jdbcServices.getSqlExceptionHelper(); }
public JdbcContextBuilder(ServiceRegistry serviceRegistry) { this.serviceRegistry = serviceRegistry; final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); this.sqlStatementLogger = jdbcServices.getSqlStatementLogger(); this.sqlExceptionHelper = jdbcServices.getSqlExceptionHelper(); this.dialect = jdbcServices.getJdbcEnvironment().getDialect(); this.jdbcConnectionAccess = jdbcServices.getBootstrapJdbcConnectionAccess(); }
@Override public SqlStatementLogger getSqlStatementLogger() { return jdbcServices.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(); }
@Override public String renderCallableStatement( String procedureName, ParameterStrategy parameterStrategy, List<ParameterRegistrationImplementor<?>> parameterRegistrations, SharedSessionContractImplementor session) { final StringBuilder buffer = new StringBuilder().append( "{call " ) .append( procedureName ) .append( "(" ); String sep = ""; for ( ParameterRegistrationImplementor parameter : parameterRegistrations ) { if ( parameter == null ) { throw new QueryException( "Parameter registrations had gaps" ); } if ( parameter.getMode() == ParameterMode.REF_CURSOR ) { verifyRefCursorSupport( session.getJdbcServices().getJdbcEnvironment().getDialect() ); buffer.append( sep ).append( "?" ); sep = ","; } else { for ( int i = 0; i < parameter.getSqlTypes().length; i++ ) { buffer.append( sep ).append( "?" ); sep = ","; } } } return buffer.append( ")}" ).toString(); }
.getBootstrapJdbcConnectionAccess() .obtainConnection(); Statement statement = connection.createStatement()) {
public InlineIdsInClauseUpdateHandlerImpl( SessionFactoryImplementor factory, HqlSqlWalker walker) { super( factory, walker ); Dialect dialect = factory.getServiceRegistry().getService( JdbcServices.class ).getDialect(); if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!" ); } }