@Override public SqlExceptionHelper getSqlExceptionHelper() { return jdbcServices.getSqlExceptionHelper(); }
@Override public SqlExceptionHelper getSqlExceptionHelper() { return jdbcServices.getSqlExceptionHelper(); }
protected final SqlExceptionHelper sqlExceptionHelper() { return getJdbcService().getSqlExceptionHelper(); }
/** * Retrieves the SqlExceptionHelper in effect for this SessionFactory. * * @return The SqlExceptionHelper for this SessionFactory. * * @deprecated since 5.0; use {@link JdbcServices#getSqlExceptionHelper()} instead as * obtained from {@link #getServiceRegistry()} */ @Deprecated default SqlExceptionHelper getSQLExceptionHelper() { return getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper(); }
protected JDBCException convertSqlException(String message, SQLException e) { // if JdbcServices#getSqlExceptionHelper is available, use it... final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); if ( jdbcServices != null && jdbcServices.getSqlExceptionHelper() != null ) { return jdbcServices.getSqlExceptionHelper().convert( e, message, null ); } // likely we are still in the process of initializing the ServiceRegistry, so use the simplified // SQLException conversion return simpleConverterAccess.getValue().convert( e, message, null ); }
@Override public JDBCException convert(SQLException e, String message) { return sharedSessionContract.getJdbcServices().getSqlExceptionHelper().convert( e, message ); }
/** * Retrieves the SQLExceptionConverter in effect for this SessionFactory. * * @return The SQLExceptionConverter for this SessionFactory. * * @deprecated since 5.0; use {@link JdbcServices#getSqlExceptionHelper()} -> * {@link SqlExceptionHelper#getSqlExceptionConverter()} instead as obtained from {@link #getServiceRegistry()} */ @Deprecated default SQLExceptionConverter getSQLExceptionConverter() { return getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper().getSqlExceptionConverter(); }
private JdbcCoordinatorImpl( LogicalConnectionImplementor logicalConnection, boolean isUserSuppliedConnection, JdbcSessionOwner owner) { this.logicalConnection = logicalConnection; this.isUserSuppliedConnection = isUserSuppliedConnection; this.owner = owner; this.exceptionHelper = owner.getJdbcSessionContext() .getServiceRegistry() .getService( JdbcServices.class ) .getSqlExceptionHelper(); }
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(); }
@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 + "]" ); } } }
protected JDBCException convert( SQLException e, String message, String sql) { throw factory().getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper().convert( e, message, sql ); }
protected JDBCException convert(SQLException e, String message) { return context.getSession().getJdbcServices().getSqlExceptionHelper().convert( e, message, context.getSql() ); }
@Override public void registerRefCursorParameter(CallableStatement statement, int position) { if ( jdbcServices.getExtractedMetaDataSupport().supportsRefCursors() ) { try { statement.registerOutParameter( position, refCursorTypeCode() ); } catch (SQLException e) { throw jdbcServices.getSqlExceptionHelper().convert( e, "Error registering REF_CURSOR parameter [" + position + "]" ); } } else { try { jdbcServices.getDialect().registerResultSetOutParameter( statement, position ); } catch (SQLException e) { throw jdbcServices.getSqlExceptionHelper().convert( e, "Error asking dialect to register ref cursor parameter [" + position + "]" ); } } }
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 IsolationDelegate createIsolationDelegate() { final JdbcSessionOwner jdbcSessionOwner = transactionCoordinatorOwner.getJdbcSessionOwner(); return new JdbcIsolationDelegate( jdbcSessionOwner.getJdbcConnectionAccess(), jdbcSessionOwner.getJdbcSessionContext().getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper() ); }
/** * 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(); }
@Override public IsolationDelegate createIsolationDelegate() { final JdbcSessionOwner jdbcSessionOwner = transactionCoordinatorOwner.getJdbcSessionOwner(); return new JtaIsolationDelegate( jdbcSessionOwner.getJdbcConnectionAccess(), jdbcSessionOwner.getJdbcSessionContext() .getServiceRegistry() .getService( JdbcServices.class ) .getSqlExceptionHelper(), jtaPlatform.retrieveTransactionManager() ); }
@Override public void accept(QueryParameter queryParameter) { try { final ParameterRegistrationImplementor registration = (ParameterRegistrationImplementor) queryParameter; registration.prepare( statement, i ); if ( registration.getMode() == ParameterMode.REF_CURSOR ) { i++; } else { i += registration.getSqlTypes().length; } } catch (SQLException e) { throw getSession().getJdbcServices().getSqlExceptionHelper().convert( e, "Error preparing registered callable parameter", getProcedureName() ); } } }
@Override public final Serializable performInsert( String insertSQL, SharedSessionContractImplementor session, Binder binder) { try { // prepare and execute the insert PreparedStatement insert = prepare( insertSQL, session ); try { binder.bindValues( insert ); return executeAndExtract( insert, session ); } finally { releaseStatement( insert, session ); } } catch (SQLException sqle) { throw session.getJdbcServices().getSqlExceptionHelper().convert( sqle, "could not insert: " + MessageHelper.infoString( persister ), insertSQL ); } }
protected Object doBatchLoad( Serializable id, Loader loaderToUse, SharedSessionContractImplementor session, Serializable[] ids, Object optionalObject, LockOptions lockOptions) { if ( log.isDebugEnabled() ) { log.debugf( "Batch loading entity: %s", MessageHelper.infoString( persister, ids, session.getFactory() ) ); } QueryParameters qp = buildQueryParameters( id, ids, optionalObject, lockOptions ); try { final List results = loaderToUse.doQueryAndInitializeNonLazyCollections( session, qp, false ); log.debug( "Done entity batch load" ); return getObjectFromList(results, id, session); } catch ( SQLException sqle ) { throw session.getJdbcServices().getSqlExceptionHelper().convert( sqle, "could not load an entity batch: " + MessageHelper.infoString( persister(), ids, session.getFactory() ), loaderToUse.getSQLString() ); } }