本文整理汇总了Java中org.hibernate.engine.jdbc.spi.JdbcServices类的典型用法代码示例。如果您正苦于以下问题:Java JdbcServices类的具体用法?Java JdbcServices怎么用?Java JdbcServices使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JdbcServices类属于org.hibernate.engine.jdbc.spi包,在下文中一共展示了JdbcServices类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyRelationalConstraints
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "UnusedParameters"})
private static void applyRelationalConstraints(ValidatorFactory factory, ActivationContext activationContext) {
final Properties properties = activationContext.getConfiguration().getProperties();
if ( ! ConfigurationHelper.getBoolean( BeanValidationIntegrator.APPLY_CONSTRAINTS, properties, true ) ){
LOG.debug( "Skipping application of relational constraints from legacy Hibernate Validator" );
return;
}
final Set<ValidationMode> modes = activationContext.getValidationModes();
if ( ! ( modes.contains( ValidationMode.DDL ) || modes.contains( ValidationMode.AUTO ) ) ) {
return;
}
applyRelationalConstraints(
factory,
activationContext.getConfiguration().createMappings().getClasses().values(),
properties,
activationContext.getServiceRegistry().getService( JdbcServices.class ).getDialect()
);
}
示例2: SchemaExport
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
public SchemaExport(ServiceRegistry serviceRegistry, Configuration configuration) {
this.connectionHelper = new SuppliedConnectionProviderConnectionHelper(
serviceRegistry.getService( ConnectionProvider.class )
);
this.sqlStatementLogger = serviceRegistry.getService( JdbcServices.class ).getSqlStatementLogger();
this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
this.sqlExceptionHelper = serviceRegistry.getService( JdbcServices.class ).getSqlExceptionHelper();
this.importFiles = ConfigurationHelper.getString(
AvailableSettings.HBM2DDL_IMPORT_FILES,
configuration.getProperties(),
DEFAULT_IMPORT_FILE
);
final Dialect dialect = serviceRegistry.getService( JdbcServices.class ).getDialect();
this.dropSQL = configuration.generateDropSchemaScript( dialect );
this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
示例3: LogicalConnectionImpl
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
/**
* Constructs a LogicalConnectionImpl
*
* @param userSuppliedConnection The user-supplied connection
* @param connectionReleaseMode The connection release mode to use
* @param jdbcServices JdbcServices
* @param jdbcConnectionAccess JDBC Connection access
*/
public LogicalConnectionImpl(
Connection userSuppliedConnection,
ConnectionReleaseMode connectionReleaseMode,
JdbcServices jdbcServices,
JdbcConnectionAccess jdbcConnectionAccess) {
this(
connectionReleaseMode,
jdbcServices,
jdbcConnectionAccess,
(userSuppliedConnection != null),
false,
new ArrayList<ConnectionObserver>()
);
this.physicalConnection = userSuppliedConnection;
}
示例4: execute
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
@Override
public void execute(Connection connection) {
try {
Statement statement = connection.createStatement();
try {
statement.executeUpdate( persister.getTemporaryIdTableDDL() );
persister.getFactory()
.getServiceRegistry()
.getService( JdbcServices.class )
.getSqlExceptionHelper()
.handleAndClearWarnings( statement, CREATION_WARNING_HANDLER );
}
finally {
try {
statement.close();
}
catch( Throwable ignore ) {
// ignore
}
}
}
catch( Exception e ) {
log.debug( "unable to create temporary id table [" + e.getMessage() + "]" );
}
}
示例5: execute
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
@Override
public void execute(Connection connection) {
try {
Statement statement = connection.createStatement();
try {
statement.executeUpdate( persister.getTemporaryIdTableDDL() );
persister.getFactory()
.getServiceRegistry()
.getService( JdbcServices.class )
.getSqlExceptionHelper()
.handleAndClearWarnings( statement, CREATION_WARNING_HANDLER );
}
finally {
try {
statement.close();
}
catch( Throwable ignore ) {
// ignore
}
}
}
catch( Exception e ) {
log.debug( "unable to create temporary id table [" + e.getMessage() + "]" );
}
}
示例6: convertSqlException
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
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 );
}
示例7: ResultSetReturnImpl
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
/**
* Constructs a ResultSetReturnImpl
*
* @param jdbcCoordinator The JdbcCoordinator
*/
public ResultSetReturnImpl(JdbcCoordinator jdbcCoordinator) {
this.jdbcCoordinator = jdbcCoordinator;
final JdbcServices jdbcServices = jdbcCoordinator.getTransactionCoordinator().getTransactionContext()
.getTransactionEnvironment()
.getJdbcServices();
this.dialect = jdbcServices.getDialect();
this.sqlStatementLogger = jdbcServices.getSqlStatementLogger();
this.sqlExceptionHelper = jdbcServices.getSqlExceptionHelper();
}
示例8: AbstractBatchImpl
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
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;
this.transactionContext = jdbcCoordinator.getTransactionCoordinator().getTransactionContext();
final JdbcServices jdbcServices = transactionContext.getTransactionEnvironment().getJdbcServices();
this.sqlStatementLogger = jdbcServices.getSqlStatementLogger();
this.sqlExceptionHelper = jdbcServices.getSqlExceptionHelper();
}
示例9: TransactionEnvironmentImpl
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
public TransactionEnvironmentImpl(SessionFactoryImpl sessionFactory) {
this.sessionFactory = sessionFactory;
this.statisticsImplementor = sessionFactory.getStatisticsImplementor();
this.serviceRegistry = sessionFactory.getServiceRegistry();
this.jdbcServices = serviceRegistry.getService( JdbcServices.class );
this.jtaPlatform = serviceRegistry.getService( JtaPlatform.class );
this.transactionFactory = serviceRegistry.getService( TransactionFactory.class );
}
示例10: prepare
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
@Override
public void prepare(
JdbcServices jdbcServices,
JdbcConnectionAccess connectionAccess,
Mappings mappings,
Mapping mapping,
Map settings) {
this.catalog = ConfigurationHelper.getString(
CATALOG,
settings,
ConfigurationHelper.getString( AvailableSettings.DEFAULT_CATALOG, settings )
);
this.schema = ConfigurationHelper.getString(
SCHEMA,
settings,
ConfigurationHelper.getString( AvailableSettings.DEFAULT_SCHEMA, settings )
);
this.cleanUpTables = ConfigurationHelper.getBoolean( CLEAN_UP_ID_TABLES, settings, false );
final Iterator<PersistentClass> entityMappings = mappings.iterateClasses();
final List<Table> idTableDefinitions = new ArrayList<Table>();
while ( entityMappings.hasNext() ) {
final PersistentClass entityMapping = entityMappings.next();
final Table idTableDefinition = generateIdTableDefinition( entityMapping );
idTableDefinitions.add( idTableDefinition );
}
exportTableDefinitions( idTableDefinitions, jdbcServices, connectionAccess, mappings, mapping );
}
示例11: checkEntityManagerFactoryConfiguration
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
public static void checkEntityManagerFactoryConfiguration(EntityManagerFactory entityManagerFactory) {
try {
SessionFactoryImpl sessionFactoryImpl = entityManagerFactory.unwrap(SessionFactoryImpl.class);
if (PostgreSQL9Dialect.class
.isInstance(sessionFactoryImpl.getServiceRegistry().getService(JdbcServices.class).getDialect())) {
//fix ClassLeftUnique and ClassRightUnique, as PostgreSQL cannot evaluate them on statement level
modifyConstraints(sessionFactoryImpl);
}
} catch (PersistenceException e) {
LogManager.getLogger()
.warn("Unsupported EntityManagerFactory found: {}", entityManagerFactory.getClass().getName());
}
}
示例12: prepare
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
@Override
public void prepare(JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess, MetadataImplementor metadata, SessionFactoryOptions sessionFactoryOptions) {
ConfigurationService configService = sessionFactoryOptions.getServiceRegistry().getService(ConfigurationService.class);
this.fullyQualifiedTableName = Objects.requireNonNull(configService.getSetting(TABLE, String.class, null), "Property " + TABLE + " must be set.");
this.idColumn = configService.getSetting(ID_COLUMN, String.class, "ID");
this.discriminatorColumn = configService.getSetting(DISCRIMINATOR_COLUMN, String.class, "ENTITY_NAME");
this.cleanRows = configService.getSetting(CLEAN_ROWS, StandardConverters.BOOLEAN, false);
}
开发者ID:grimsa,项目名称:hibernate-single-table-bulk-id-strategy,代码行数:9,代码来源:SingleGlobalTemporaryTableBulkIdStrategy.java
示例13: prepare
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
@Override
public void prepare(
JdbcServices jdbcServices,
JdbcConnectionAccess jdbcConnectionAccess,
MetadataImplementor metadataImplementor,
SessionFactoryOptions sessionFactoryOptions) {
}
开发者ID:epiresdasilva,项目名称:cte-multi-table-bulk-id-stategy,代码行数:9,代码来源:CTEMultiTableBulkIdStrategy.java
示例14: DbOpenHelper
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
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();
}
示例15: generateIncrementally
import org.hibernate.engine.jdbc.spi.JdbcServices; //导入依赖的package包/类
/**
* Updates (or inserts) table column value with existing id
*
* @param session
* @param currentValue
* @return {@link Serializable}
*/
public Serializable generateIncrementally(final SessionImplementor session,
final long currentValue) {
final SqlStatementLogger statementLogger = session.getFactory()
.getServiceRegistry().getService(JdbcServices.class)
.getSqlStatementLogger();
final AccessCallback callback = new AccessCallbackImpl(session,
currentValue, statementLogger);
return optimizer.generate(callback);
}