org.hibernate.resource.jdbc.spi.StatementInspector Java Examples
The following examples show how to use
org.hibernate.resource.jdbc.spi.StatementInspector.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JdbcSessionContextImpl.java From lams with GNU General Public License v2.0 | 5 votes |
public JdbcSessionContextImpl(SharedSessionContractImplementor session, StatementInspector statementInspector) { this.sessionFactory = session.getFactory(); this.statementInspector = statementInspector; this.connectionHandlingMode = settings().getPhysicalConnectionHandlingMode(); this.serviceRegistry = sessionFactory.getServiceRegistry(); this.jdbcObserver = new JdbcObserverImpl( session ); if ( this.statementInspector == null ) { throw new IllegalArgumentException( "StatementInspector cannot be null" ); } }
Example #2
Source File: AbstractSharedSessionContract.java From lams with GNU General Public License v2.0 | 5 votes |
private StatementInspector interpret(StatementInspector statementInspector) { if ( statementInspector == null ) { // If there is no StatementInspector specified, map to the call // to the (deprecated) Interceptor #onPrepareStatement method return (StatementInspector) interceptor::onPrepareStatement; } return statementInspector; }
Example #3
Source File: AbstractSharedSessionContract.java From lams with GNU General Public License v2.0 | 5 votes |
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException, SQLException { if ( log.isTraceEnabled() ) { log.trace( "Deserializing " + getClass().getSimpleName() ); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Step 1 :: read back non-transient state... ois.defaultReadObject(); sessionEventsManager = new SessionEventListenerManagerImpl(); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Step 2 :: read back transient state... // -- see above factory = SessionFactoryImpl.deserialize( ois ); jdbcSessionContext = new JdbcSessionContextImpl( this, (StatementInspector) ois.readObject() ); jdbcCoordinator = JdbcCoordinatorImpl.deserialize( ois, this ); cacheTransactionSync = factory.getCache().getRegionFactory().createTransactionContext( this ); transactionCoordinator = factory.getServiceRegistry() .getService( TransactionCoordinatorBuilder.class ) .buildTransactionCoordinator( jdbcCoordinator, this ); entityNameResolver = new CoordinatingEntityNameResolver( factory, interceptor ); exceptionConverter = new ExceptionConverterImpl( this ); }
Example #4
Source File: JdbcSessionContextImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public StatementInspector getStatementInspector() { return statementInspector; }
Example #5
Source File: SessionFactoryImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public StatementInspector getStatementInspector() { return statementInspector; }
Example #6
Source File: SessionFactoryImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public StatementInspector getStatementInspector() { return null; }
Example #7
Source File: AbstractSharedSessionContract.java From lams with GNU General Public License v2.0 | 4 votes |
public AbstractSharedSessionContract(SessionFactoryImpl factory, SessionCreationOptions options) { this.factory = factory; this.cacheTransactionSync = factory.getCache().getRegionFactory().createTransactionContext( this ); this.flushMode = options.getInitialSessionFlushMode(); this.tenantIdentifier = options.getTenantIdentifier(); if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) { if ( tenantIdentifier != null ) { throw new HibernateException( "SessionFactory was not configured for multi-tenancy" ); } } else { if ( tenantIdentifier == null ) { throw new HibernateException( "SessionFactory configured for multi-tenancy, but no tenant identifier specified" ); } } this.interceptor = interpret( options.getInterceptor() ); this.jdbcTimeZone = options.getJdbcTimeZone(); final StatementInspector statementInspector = interpret( options.getStatementInspector() ); this.jdbcSessionContext = new JdbcSessionContextImpl( this, statementInspector ); this.entityNameResolver = new CoordinatingEntityNameResolver( factory, interceptor ); if ( options instanceof SharedSessionCreationOptions && ( (SharedSessionCreationOptions) options ).isTransactionCoordinatorShared() ) { if ( options.getConnection() != null ) { throw new SessionException( "Cannot simultaneously share transaction context and specify connection" ); } this.isTransactionCoordinatorShared = true; final SharedSessionCreationOptions sharedOptions = (SharedSessionCreationOptions) options; this.transactionCoordinator = sharedOptions.getTransactionCoordinator(); this.jdbcCoordinator = sharedOptions.getJdbcCoordinator(); // todo : "wrap" the transaction to no-op cmmit/rollback attempts? this.currentHibernateTransaction = sharedOptions.getTransaction(); if ( sharedOptions.shouldAutoJoinTransactions() ) { log.debug( "Session creation specified 'autoJoinTransactions', which is invalid in conjunction " + "with sharing JDBC connection between sessions; ignoring" ); autoJoinTransactions = false; } if ( sharedOptions.getPhysicalConnectionHandlingMode() != this.jdbcCoordinator.getLogicalConnection().getConnectionHandlingMode() ) { log.debug( "Session creation specified 'PhysicalConnectionHandlingMode which is invalid in conjunction " + "with sharing JDBC connection between sessions; ignoring" ); } addSharedSessionTransactionObserver( transactionCoordinator ); } else { this.isTransactionCoordinatorShared = false; this.autoJoinTransactions = options.shouldAutoJoinTransactions(); this.jdbcCoordinator = new JdbcCoordinatorImpl( options.getConnection(), this ); this.transactionCoordinator = factory.getServiceRegistry() .getService( TransactionCoordinatorBuilder.class ) .buildTransactionCoordinator( jdbcCoordinator, this ); } exceptionConverter = new ExceptionConverterImpl( this ); }
Example #8
Source File: AbstractDelegatingSessionFactoryOptions.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public StatementInspector getStatementInspector() { return delegate.getStatementInspector(); }
Example #9
Source File: AbstractDelegatingSessionFactoryBuilder.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public T applyStatementInspector(StatementInspector statementInspector) { delegate.applyStatementInspector( statementInspector ); return getThis(); }
Example #10
Source File: SessionFactoryOptionsBuilder.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public StatementInspector getStatementInspector() { return statementInspector; }
Example #11
Source File: SessionFactoryOptionsBuilder.java From lams with GNU General Public License v2.0 | 4 votes |
public void applyStatementInspector(StatementInspector statementInspector) { this.statementInspector = statementInspector; }
Example #12
Source File: SessionFactoryBuilderImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public SessionFactoryBuilder applyStatementInspector(StatementInspector statementInspector) { this.optionsBuilder.applyStatementInspector( statementInspector ); return this; }
Example #13
Source File: SessionFactoryBuilder.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Names a StatementInspector to be applied to the SessionFactory, which in turn means it will be used by all * Sessions unless one is explicitly specified in {@link org.hibernate.SessionBuilder#statementInspector} * * @param statementInspector The StatementInspector * * @return {@code this}, for method chaining * * @see org.hibernate.cfg.AvailableSettings#STATEMENT_INSPECTOR */ SessionFactoryBuilder applyStatementInspector(StatementInspector statementInspector);
Example #14
Source File: SessionCreationOptions.java From lams with GNU General Public License v2.0 | votes |
StatementInspector getStatementInspector();
Example #15
Source File: SessionFactoryOptions.java From lams with GNU General Public License v2.0 | votes |
StatementInspector getStatementInspector();