use of org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData in project hibernate-orm by hibernate.
the class ProcedureCallImpl method prepareForNamedParameters.
private void prepareForNamedParameters() {
if (parameterStrategy == ParameterStrategy.POSITIONAL) {
throw new QueryException("Cannot mix named and positional parameters");
}
if (parameterStrategy == ParameterStrategy.UNKNOWN) {
// protect to only do this check once
final ExtractedDatabaseMetaData databaseMetaData = getSession().getJdbcCoordinator().getJdbcSessionOwner().getJdbcSessionContext().getServiceRegistry().getService(JdbcEnvironment.class).getExtractedDatabaseMetaData();
if (!databaseMetaData.supportsNamedParameters()) {
LOG.unsupportedNamedParameters();
}
parameterStrategy = ParameterStrategy.NAMED;
}
}
use of org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData in project hibernate-orm by hibernate.
the class NoDatabaseMetaDataTest method testNoJdbcMetadataDefaultDialect.
@Test
@TestForIssue(jiraKey = "HHH-10515")
public void testNoJdbcMetadataDefaultDialect() {
final StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySetting("hibernate.temp.use_jdbc_metadata_defaults", "false").build();
JdbcEnvironment jdbcEnvironment = serviceRegistry.getService(JdbcEnvironment.class);
ExtractedDatabaseMetaData extractedDatabaseMetaData = jdbcEnvironment.getExtractedDatabaseMetaData();
assertNull(extractedDatabaseMetaData.getConnectionCatalogName());
assertNull(extractedDatabaseMetaData.getConnectionSchemaName());
assertTrue(extractedDatabaseMetaData.getTypeInfoSet().isEmpty());
assertTrue(extractedDatabaseMetaData.getExtraKeywords().isEmpty());
assertFalse(extractedDatabaseMetaData.supportsNamedParameters());
assertFalse(extractedDatabaseMetaData.supportsRefCursors());
assertFalse(extractedDatabaseMetaData.supportsScrollableResults());
assertFalse(extractedDatabaseMetaData.supportsGetGeneratedKeys());
assertFalse(extractedDatabaseMetaData.supportsBatchUpdates());
assertFalse(extractedDatabaseMetaData.supportsDataDefinitionInTransaction());
assertFalse(extractedDatabaseMetaData.doesDataDefinitionCauseTransactionCommit());
assertNull(extractedDatabaseMetaData.getSqlStateType());
assertFalse(extractedDatabaseMetaData.doesLobLocatorUpdateCopy());
StandardServiceRegistryBuilder.destroy(serviceRegistry);
}
use of org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData in project hibernate-orm by hibernate.
the class NoDatabaseMetaDataTest method testNoJdbcMetadataDialectOverride.
@Test
@TestForIssue(jiraKey = "HHH-10515")
public void testNoJdbcMetadataDialectOverride() {
final StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySetting("hibernate.temp.use_jdbc_metadata_defaults", "false").applySetting(AvailableSettings.DIALECT, TestDialect.class.getName()).build();
JdbcEnvironment jdbcEnvironment = serviceRegistry.getService(JdbcEnvironment.class);
ExtractedDatabaseMetaData extractedDatabaseMetaData = jdbcEnvironment.getExtractedDatabaseMetaData();
assertNull(extractedDatabaseMetaData.getConnectionCatalogName());
assertNull(extractedDatabaseMetaData.getConnectionSchemaName());
assertTrue(extractedDatabaseMetaData.getTypeInfoSet().isEmpty());
assertTrue(extractedDatabaseMetaData.getExtraKeywords().isEmpty());
assertTrue(extractedDatabaseMetaData.supportsNamedParameters());
assertFalse(extractedDatabaseMetaData.supportsRefCursors());
assertFalse(extractedDatabaseMetaData.supportsScrollableResults());
assertFalse(extractedDatabaseMetaData.supportsGetGeneratedKeys());
assertFalse(extractedDatabaseMetaData.supportsBatchUpdates());
assertFalse(extractedDatabaseMetaData.supportsDataDefinitionInTransaction());
assertFalse(extractedDatabaseMetaData.doesDataDefinitionCauseTransactionCommit());
assertNull(extractedDatabaseMetaData.getSqlStateType());
assertFalse(extractedDatabaseMetaData.doesLobLocatorUpdateCopy());
StandardServiceRegistryBuilder.destroy(serviceRegistry);
}
Aggregations