本文整理汇总了Java中org.hibernate.engine.jdbc.spi.SqlExceptionHelper类的典型用法代码示例。如果您正苦于以下问题:Java SqlExceptionHelper类的具体用法?Java SqlExceptionHelper怎么用?Java SqlExceptionHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlExceptionHelper类属于org.hibernate.engine.jdbc.spi包,在下文中一共展示了SqlExceptionHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SchemaExport
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
/**
* Create a schema exporter for the given Configuration, with the given
* database connection properties.
*
* @param configuration The configuration from which to build a schema export.
* @param properties The properties from which to configure connectivity etc.
* @throws HibernateException Indicates problem preparing for schema export.
*
* @deprecated properties may be specified via the Configuration object
*/
@Deprecated
public SchemaExport(Configuration configuration, Properties properties) throws HibernateException {
final Dialect dialect = Dialect.getDialect( properties );
Properties props = new Properties();
props.putAll( dialect.getDefaultProperties() );
props.putAll( properties );
this.connectionHelper = new ManagedProviderConnectionHelper( props );
this.sqlStatementLogger = new SqlStatementLogger( false, true );
this.formatter = FormatStyle.DDL.getFormatter();
this.sqlExceptionHelper = new SqlExceptionHelper();
this.importFiles = ConfigurationHelper.getString(
AvailableSettings.HBM2DDL_IMPORT_FILES,
properties,
DEFAULT_IMPORT_FILE
);
this.dropSQL = configuration.generateDropSchemaScript( dialect );
this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:SchemaExport.java
示例2: execute
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
private void execute(boolean script, boolean export, Writer fileOutput, Statement statement, final String sql)
throws IOException, SQLException {
final SqlExceptionHelper sqlExceptionHelper = new SqlExceptionHelper();
String formatted = formatter.format( sql );
if (delimiter != null) formatted += delimiter;
if (script) System.out.println(formatted);
LOG.debug(formatted);
if ( outputFile != null ) {
fileOutput.write( formatted + "\n" );
}
if ( export ) {
statement.executeUpdate( sql );
try {
SQLWarning warnings = statement.getWarnings();
if ( warnings != null) {
sqlExceptionHelper.logAndClearWarnings( connectionHelper.getConnection() );
}
}
catch( SQLException sqle ) {
LOG.unableToLogSqlWarnings(sqle);
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:SchemaExport.java
示例3: testDeleteStorageConstraintViolation
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
@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);
}
});
}
开发者ID:FINRAOS,项目名称:herd,代码行数:21,代码来源:StorageServiceTest.java
示例4: testCreateBusinessObjectDataAttributeValueTooLarge
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
@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);
}
});
}
开发者ID:FINRAOS,项目名称:herd,代码行数:22,代码来源:BusinessObjectDataServiceCreateBusinessObjectDataTest.java
示例5: releaseConnection
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
private void releaseConnection() throws SQLException {
if ( connection != null ) {
try {
new SqlExceptionHelper().logAndClearWarnings( connection );
}
finally {
try {
serviceRegistry.getService( ConnectionProvider.class ).closeConnection( connection );
}
finally {
connection = null;
}
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:ManagedProviderConnectionHelper.java
示例6: release
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
public void release() throws SQLException {
// we only release the connection
if ( connection != null ) {
new SqlExceptionHelper().logAndClearWarnings( connection );
if ( toggleAutoCommit ) {
connection.setAutoCommit( false );
}
provider.closeConnection( connection );
connection = null;
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:SuppliedConnectionProviderConnectionHelper.java
示例7: release
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
public void release() throws SQLException {
new SqlExceptionHelper().logAndClearWarnings( connection );
if ( toggleAutoCommit ) {
connection.setAutoCommit( false );
}
connection = null;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:SuppliedConnectionHelper.java
示例8: SchemaUpdate
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
public SchemaUpdate(Configuration configuration, Properties properties) throws HibernateException {
this.configuration = configuration;
this.dialect = Dialect.getDialect( properties );
Properties props = new Properties();
props.putAll( dialect.getDefaultProperties() );
props.putAll( properties );
this.connectionHelper = new ManagedProviderConnectionHelper( props );
this.sqlExceptionHelper = new SqlExceptionHelper();
this.sqlStatementLogger = new SqlStatementLogger( false, true );
this.formatter = FormatStyle.DDL.getFormatter();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:SchemaUpdate.java
示例9: DatabaseExporter
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
public DatabaseExporter(ConnectionHelper connectionHelper, SqlExceptionHelper sqlExceptionHelper) throws SQLException {
this.connectionHelper = connectionHelper;
this.sqlExceptionHelper = sqlExceptionHelper;
connectionHelper.prepare( true );
connection = connectionHelper.getConnection();
statement = connection.createStatement();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:DatabaseExporter.java
示例10: getSQLExceptionHelper
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
public SqlExceptionHelper getSQLExceptionHelper() {
return getJdbcServices().getSqlExceptionHelper();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:SessionFactoryImpl.java
示例11: testCreateBusinessObjectFormatIncorrectLatestVersion
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
@Test
public void testCreateBusinessObjectFormatIncorrectLatestVersion() throws Exception
{
// Create relative database entities.
businessObjectFormatServiceTestHelper.createTestDatabaseEntitiesForBusinessObjectFormatTesting();
// Create a first version of the format with the latest flag set to false.
businessObjectFormatDaoTestHelper
.createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, FORMAT_DESCRIPTION, false,
PARTITION_KEY);
try
{
// Try to create a new format version for this format.
final BusinessObjectFormatCreateRequest businessObjectFormatCreateRequest = businessObjectFormatServiceTestHelper
.createBusinessObjectFormatCreateRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, PARTITION_KEY, FORMAT_DESCRIPTION,
businessObjectDefinitionServiceTestHelper.getNewAttributes(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(),
businessObjectFormatServiceTestHelper.getTestSchema());
executeWithoutLogging(SqlExceptionHelper.class, new Command()
{
@Override
public void execute()
{
businessObjectFormatService.createBusinessObjectFormat(businessObjectFormatCreateRequest);
fail("Should throw a PersistenceException since the latest flag does not identify the maximum format version.");
}
});
}
catch (PersistenceException e)
{
assertTrue(e.getMessage().contains("ConstraintViolationException: could not execute statement"));
}
}
开发者ID:FINRAOS,项目名称:herd,代码行数:34,代码来源:BusinessObjectFormatServiceTest.java
示例12: releaseConnection
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
private void releaseConnection() throws SQLException {
if (connection != null) {
try {
new SqlExceptionHelper().logAndClearWarnings(connection);
} finally {
try {
serviceRegistry.getService(ConnectionProvider.class).closeConnection(connection);
} finally {
connection = null;
}
}
}
}
开发者ID:sismics,项目名称:books,代码行数:14,代码来源:ManagedProvidedConnectionHelper.java
示例13: release
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
@Override
public void release() throws SQLException {
// we only release the connection
if ( connection != null ) {
new SqlExceptionHelper().logAndClearWarnings( connection );
if ( toggleAutoCommit ) {
connection.setAutoCommit( false );
}
provider.closeConnection( connection );
connection = null;
}
}
开发者ID:sismics,项目名称:books,代码行数:13,代码来源:SuppliedConnectionProviderConnectionHelper.java
示例14: getSQLExceptionHelper
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
public SqlExceptionHelper getSQLExceptionHelper() {
return sessionFactoryImplementor.getSQLExceptionHelper();
}
开发者ID:zhaojunfei,项目名称:lemon,代码行数:4,代码来源:SessionFactoryWrapper.java
示例15: getSQLExceptionHelper
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
protected SqlExceptionHelper getSQLExceptionHelper() {
return sqlExceptionHelper;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:AbstractCollectionPersister.java
示例16: getTableMetadata
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
public TableMetadata getTableMetadata(String name, String schema, String catalog, boolean isQuoted) throws HibernateException {
Object identifier = identifier(catalog, schema, name);
TableMetadata table = (TableMetadata) tables.get(identifier);
if (table!=null) {
return table;
}
else {
try {
ResultSet rs = null;
try {
if ( (isQuoted && meta.storesMixedCaseQuotedIdentifiers())) {
rs = meta.getTables(catalog, schema, name, types);
} else if ( (isQuoted && meta.storesUpperCaseQuotedIdentifiers())
|| (!isQuoted && meta.storesUpperCaseIdentifiers() )) {
rs = meta.getTables(
StringHelper.toUpperCase(catalog),
StringHelper.toUpperCase(schema),
StringHelper.toUpperCase(name),
types
);
}
else if ( (isQuoted && meta.storesLowerCaseQuotedIdentifiers())
|| (!isQuoted && meta.storesLowerCaseIdentifiers() )) {
rs = meta.getTables(
StringHelper.toLowerCase( catalog ),
StringHelper.toLowerCase(schema),
StringHelper.toLowerCase(name),
types
);
}
else {
rs = meta.getTables(catalog, schema, name, types);
}
while ( rs.next() ) {
String tableName = rs.getString("TABLE_NAME");
if ( name.equalsIgnoreCase(tableName) ) {
table = new TableMetadata(rs, meta, extras);
tables.put(identifier, table);
return table;
}
}
LOG.tableNotFound( name );
return null;
}
finally {
if ( rs != null ) {
rs.close();
}
}
}
catch (SQLException sqlException) {
throw new SqlExceptionHelper( sqlExceptionConverter )
.convert( sqlException, "could not get table metadata: " + name );
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:63,代码来源:DatabaseMetadata.java
示例17: sqlExceptionHelper
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
protected SqlExceptionHelper sqlExceptionHelper() {
return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().getJdbcServices().getSqlExceptionHelper();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:JdbcIsolationDelegate.java
示例18: sqlExceptionHelper
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
protected SqlExceptionHelper sqlExceptionHelper() {
return transactionCoordinator.getTransactionContext()
.getTransactionEnvironment()
.getJdbcServices()
.getSqlExceptionHelper();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:JtaIsolationDelegate.java
示例19: getSqlExceptionHelper
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
@Override
public SqlExceptionHelper getSqlExceptionHelper() {
return sqlExceptionHelper;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:JdbcServicesImpl.java
示例20: sqlExceptionHelper
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; //导入依赖的package包/类
protected final SqlExceptionHelper sqlExceptionHelper() {
return jdbcCoordinator.getTransactionCoordinator().getTransactionContext().getTransactionEnvironment()
.getJdbcServices()
.getSqlExceptionHelper();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:StatementPreparerImpl.java
注:本文中的org.hibernate.engine.jdbc.spi.SqlExceptionHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论