类org.hibernate.resource.jdbc.spi.StatementInspector源码实例Demo

下面列出了怎么用org.hibernate.resource.jdbc.spi.StatementInspector的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: JdbcSessionContextImpl.java
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" );
	}
}
 
源代码2 项目: lams   文件: AbstractSharedSessionContract.java
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;
}
 
源代码3 项目: lams   文件: AbstractSharedSessionContract.java
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 );
}
 
源代码4 项目: lams   文件: JdbcSessionContextImpl.java
@Override
public StatementInspector getStatementInspector() {
	return statementInspector;
}
 
源代码5 项目: lams   文件: SessionFactoryImpl.java
@Override
public StatementInspector getStatementInspector() {
	return statementInspector;
}
 
源代码6 项目: lams   文件: SessionFactoryImpl.java
@Override
public StatementInspector getStatementInspector() {
	return null;
}
 
源代码7 项目: lams   文件: AbstractSharedSessionContract.java
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 );
}
 
@Override
public StatementInspector getStatementInspector() {
	return delegate.getStatementInspector();
}
 
@Override
public T applyStatementInspector(StatementInspector statementInspector) {
	delegate.applyStatementInspector( statementInspector );
	return getThis();
}
 
源代码10 项目: lams   文件: SessionFactoryOptionsBuilder.java
@Override
public StatementInspector getStatementInspector() {
	return statementInspector;
}
 
源代码11 项目: lams   文件: SessionFactoryOptionsBuilder.java
public void applyStatementInspector(StatementInspector statementInspector) {
	this.statementInspector = statementInspector;
}
 
源代码12 项目: lams   文件: SessionFactoryBuilderImpl.java
@Override
public SessionFactoryBuilder applyStatementInspector(StatementInspector statementInspector) {
	this.optionsBuilder.applyStatementInspector( statementInspector );
	return this;
}
 
源代码13 项目: lams   文件: SessionFactoryBuilder.java
/**
 * 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);
 
源代码14 项目: lams   文件: SessionCreationOptions.java
StatementInspector getStatementInspector(); 
源代码15 项目: lams   文件: SessionFactoryOptions.java
StatementInspector getStatementInspector(); 
 类所在包
 类方法
 同包方法