类org.hibernate.engine.jdbc.spi.SqlExceptionHelper源码实例Demo

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

源代码1 项目: herd   文件: StorageServiceTest.java
@Ignore
@Test(expected = PersistenceException.class)
public void testDeleteStorageConstraintViolation() throws Exception
{
    // Create a storage unit entity that refers to a newly created storage.
    final StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper
        .createStorageUnitEntity(STORAGE_NAME, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
            SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, STORAGE_UNIT_STATUS, NO_STORAGE_DIRECTORY_PATH);

    executeWithoutLogging(SqlExceptionHelper.class, new Command()
    {
        @Override
        public void execute()
        {
            // Delete the storage which is invalid because there still exists a storage unit entity that references it.
            StorageKey alternateKey = new StorageKey(storageUnitEntity.getStorage().getName());
            storageService.deleteStorage(alternateKey);
        }
    });
}
 
@Test(expected = PersistenceException.class)
public void testCreateBusinessObjectDataAttributeValueTooLarge() throws Exception
{
    final BusinessObjectDataCreateRequest businessObjectDataCreateRequest = businessObjectDataServiceTestHelper.getNewBusinessObjectDataCreateRequest();

    // Create and add a duplicate attribute which is not allowed.
    Attribute newAttribute = new Attribute();
    newAttribute.setName("Valid Name");
    newAttribute.setValue(new String(new char[4001]).replace('\0', 'A')); // Test value greater than 4000 byte limit.
    businessObjectDataCreateRequest.getAttributes().add(newAttribute);

    executeWithoutLogging(SqlExceptionHelper.class, new Command()
    {
        @Override
        public void execute()
        {
            // Create the business object data which is invalid.
            businessObjectDataService.createBusinessObjectData(businessObjectDataCreateRequest);
        }
    });
}
 
源代码3 项目: lams   文件: JtaIsolationDelegate.java
public JtaIsolationDelegate(
		JdbcConnectionAccess connectionAccess,
		SqlExceptionHelper sqlExceptionHelper,
		TransactionManager transactionManager) {
	this.connectionAccess = connectionAccess;
	this.sqlExceptionHelper = sqlExceptionHelper;
	this.transactionManager = transactionManager;
}
 
源代码4 项目: lams   文件: DatabaseExporter.java
public DatabaseExporter(ConnectionHelper connectionHelper, SqlExceptionHelper sqlExceptionHelper) throws SQLException {
	this.connectionHelper = connectionHelper;
	this.sqlExceptionHelper = sqlExceptionHelper;

	connectionHelper.prepare( true );
	connection = connectionHelper.getConnection();
	statement = connection.createStatement();
}
 
源代码5 项目: lams   文件: HibernateSchemaManagementTool.java
private JdbcContextImpl(
		JdbcConnectionAccess jdbcConnectionAccess,
		Dialect dialect,
		SqlStatementLogger sqlStatementLogger,
		SqlExceptionHelper sqlExceptionHelper,
		ServiceRegistry serviceRegistry) {
	this.jdbcConnectionAccess = jdbcConnectionAccess;
	this.dialect = dialect;
	this.sqlStatementLogger = sqlStatementLogger;
	this.sqlExceptionHelper = sqlExceptionHelper;
	this.serviceRegistry = serviceRegistry;
}
 
源代码6 项目: lams   文件: JdbcEnvironmentImpl.java
@SuppressWarnings("deprecation")
private SqlExceptionHelper buildSqlExceptionHelper(Dialect dialect, boolean logWarnings) {
	final StandardSQLExceptionConverter sqlExceptionConverter = new StandardSQLExceptionConverter();
	sqlExceptionConverter.addDelegate( dialect.buildSQLExceptionConversionDelegate() );
	sqlExceptionConverter.addDelegate( new SQLExceptionTypeDelegate( dialect ) );
	// todo : vary this based on extractedMetaDataSupport.getSqlStateType()
	sqlExceptionConverter.addDelegate( new SQLStateConversionDelegate( dialect ) );
	return new SqlExceptionHelper( sqlExceptionConverter, logWarnings );
}
 
源代码7 项目: lams   文件: JdbcServicesImpl.java
@Override
public SqlExceptionHelper getSqlExceptionHelper() {
	if ( jdbcEnvironment != null ) {
		return jdbcEnvironment.getSqlExceptionHelper();
	}
	return null;
}
 
源代码8 项目: hibernate-reactive   文件: TestingRegistryRule.java
@Override @SuppressWarnings("unchecked")
public <R extends Service> R getService(Class<R> serviceRole) {
    if ( serviceRole == VertxInstance.class ) {
        return (R) vertxService;
    }
    else if ( serviceRole == JdbcEnvironment.class ) {
        return (R) new JdbcEnvironment() {
            @Override
            public Dialect getDialect() {
                return new MySQL8Dialect();
            }

            @Override
            public ExtractedDatabaseMetaData getExtractedDatabaseMetaData() {
                return null;
            }

            @Override
            public Identifier getCurrentCatalog() {
                return null;
            }

            @Override
            public Identifier getCurrentSchema() {
                return null;
            }

            @Override
            public QualifiedObjectNameFormatter getQualifiedObjectNameFormatter() {
                return null;
            }

            @Override
            public IdentifierHelper getIdentifierHelper() {
                return null;
            }

            @Override
            public NameQualifierSupport getNameQualifierSupport() {
                return null;
            }

            @Override
            public SqlExceptionHelper getSqlExceptionHelper() {
                return null;
            }

            @Override
            public LobCreatorBuilder getLobCreatorBuilder() {
                return null;
            }

            @Override
            public TypeInfo getTypeInfoForJdbcCode(int jdbcTypeCode) {
                return null;
            }
        };
    }
    else {
        throw new IllegalArgumentException( "This is a mock service - need to explicitly handle any service we might need during testing" );
    }
}
 
源代码9 项目: lams   文件: JdbcIsolationDelegate.java
public JdbcIsolationDelegate(JdbcConnectionAccess connectionAccess, SqlExceptionHelper sqlExceptionHelper) {
	this.connectionAccess = connectionAccess;
	this.sqlExceptionHelper = sqlExceptionHelper;
}
 
源代码10 项目: lams   文件: JdbcIsolationDelegate.java
protected SqlExceptionHelper sqlExceptionHelper() {
	return this.sqlExceptionHelper;
}
 
源代码11 项目: lams   文件: JtaIsolationDelegate.java
protected SqlExceptionHelper sqlExceptionHelper() {
	return this.sqlExceptionHelper;
}
 
源代码12 项目: lams   文件: AbstractCollectionPersister.java
protected SqlExceptionHelper getSQLExceptionHelper() {
	return sqlExceptionHelper;
}
 
public SuppliedConnectionProviderConnectionHelper(ConnectionProvider provider, SqlExceptionHelper sqlExceptionHelper)  {
	this.provider = provider;
	this.sqlExceptionHelper = sqlExceptionHelper;
}
 
源代码14 项目: lams   文件: SuppliedConnectionHelper.java
public SuppliedConnectionHelper(Connection connection, SqlExceptionHelper sqlExceptionHelper) {
	this.connection = connection;
	this.sqlExceptionHelper = sqlExceptionHelper;
}
 
源代码15 项目: lams   文件: HibernateSchemaManagementTool.java
@Override
public SqlExceptionHelper getSqlExceptionHelper() {
	return sqlExceptionHelper;
}
 
源代码16 项目: lams   文件: SchemaDropperImpl.java
@Override
public SqlExceptionHelper getSqlExceptionHelper() {
	return jdbcServices.getSqlExceptionHelper();
}
 
源代码17 项目: lams   文件: JdbcEnvironmentImpl.java
@Override
public SqlExceptionHelper getSqlExceptionHelper() {
	return sqlExceptionHelper;
}
 
源代码18 项目: lams   文件: StatementPreparerImpl.java
protected final SqlExceptionHelper sqlExceptionHelper() {
	return getJdbcService().getSqlExceptionHelper();
}
 
源代码19 项目: lams   文件: SessionFactoryDelegatingImpl.java
@Override
public SqlExceptionHelper getSQLExceptionHelper() {
	return delegate.getSQLExceptionHelper();
}
 
源代码20 项目: lemon   文件: SessionFactoryWrapper.java
public SqlExceptionHelper getSQLExceptionHelper() {
    return sessionFactoryImplementor.getSQLExceptionHelper();
}
 
源代码21 项目: lams   文件: JdbcEnvironment.java
/**
 * Obtain the helper for dealing with JDBC {@link java.sql.SQLException} faults.
 *
 * @return This environment's helper.
 */
SqlExceptionHelper getSqlExceptionHelper();
 
源代码22 项目: lams   文件: JdbcCoordinatorImpl.java
/**
 * Access to the SqlExceptionHelper
 *
 * @return The SqlExceptionHelper
 */
public SqlExceptionHelper sqlExceptionHelper() {
	return exceptionHelper;
}
 
源代码23 项目: lams   文件: AbstractBatchImpl.java
/**
 * Convenience access to the SQLException helper.
 *
 * @return The underlying SQLException helper.
 */
protected SqlExceptionHelper sqlExceptionHelper() {
	return sqlExceptionHelper;
}
 
源代码24 项目: lams   文件: SessionFactoryImplementor.java
/**
 * 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();
}
 
源代码25 项目: lams   文件: JdbcContext.java
SqlExceptionHelper getSqlExceptionHelper(); 
 类所在包
 类方法
 同包方法