remove hibernate.jdbc.use_streams_for_binary config property

this should be handled by the Dialects
This commit is contained in:
Gavin King 2022-01-21 14:50:23 +01:00
parent 8327f8567d
commit 329b2fc9c4
18 changed files with 8 additions and 101 deletions

View File

@ -600,9 +600,6 @@ A non-zero value determines the JDBC fetch size, by calling `Statement.setFetchS
`*hibernate.jdbc.use_scrollable_resultset*` (e.g. `true` or `false`)::
Enables Hibernate to use JDBC2 scrollable resultsets. This property is only relevant for user-supplied JDBC connections. Otherwise, Hibernate uses connection metadata.
`*hibernate.jdbc.use_streams_for_binary*` (e.g. `true` or `false` (default value))::
Use streams when writing or reading `binary` or `serializable` types to or from JDBC. This is a system-level property.
`*hibernate.jdbc.use_get_generated_keys*` (e.g. `true` or `false`)::
Allows Hibernate to use JDBC3 `PreparedStatement.getGeneratedKeys()` to retrieve natively-generated keys after insert. You need the JDBC3+ driver and JRE1.4+. Disable this property if your driver has problems with the Hibernate identifier generators. By default, it tries to detect the driver capabilities from connection metadata.

View File

@ -398,11 +398,6 @@ hibernate.jdbc.batch_versioned_data true
#hibernate.jdbc.use_scrollable_resultset true
## use streams when writing binary types to / from JDBC
hibernate.jdbc.use_streams_for_binary true
## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
#hibernate.jdbc.use_get_generated_keys false

View File

@ -362,11 +362,6 @@ hibernate.jdbc.batch_versioned_data true
#hibernate.jdbc.use_scrollable_resultset true
## use streams when writing binary types to / from JDBC
hibernate.jdbc.use_streams_for_binary true
## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
#hibernate.jdbc.use_get_generated_keys false

View File

@ -121,11 +121,6 @@ public class CUBRIDDialect extends Dialect {
return 15;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return true;
}
@Override
public int getMaxVarcharLength() {
return 1_073_741_823;

View File

@ -107,11 +107,6 @@ public class MimerSQLDialect extends Dialect {
return 50;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return true;
}
@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
super.initializeFunctionRegistry( queryEngine );

View File

@ -124,7 +124,7 @@ public class TeradataDialect extends Dialect {
}
@Override
public boolean getDefaultUseStreamsForBinary() {
public boolean useInputStreamToInsertBlob() {
return getVersion().isSameOrAfter( 14 );
}

View File

@ -113,11 +113,6 @@ public class TimesTenDialect extends Dialect {
return 15;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return true;
}
@Override
public JdbcType resolveSqlTypeDescriptor(
String columnTypeName,

View File

@ -11,7 +11,6 @@ import java.util.function.Supplier;
import org.hibernate.HibernateException;
import org.hibernate.jpa.HibernateHints;
import org.hibernate.query.NativeQuery;
import org.hibernate.query.Query;
import org.hibernate.Transaction;
import org.hibernate.boot.MetadataBuilder;
import org.hibernate.boot.registry.classloading.internal.TcclLookupPrecedence;
@ -776,11 +775,6 @@ public interface AvailableSettings {
*/
String DEFAULT_BATCH_FETCH_SIZE = "hibernate.default_batch_fetch_size";
/**
* Use {@code java.io} streams to read / write binary data from / to JDBC
*/
String USE_STREAMS_FOR_BINARY = "hibernate.jdbc.use_streams_for_binary";
/**
* Use JDBC scrollable {@code ResultSet}s. This property is only necessary when there is
* no {@code ConnectionProvider}, that is, when the client is supplying JDBC connections.

View File

@ -34,11 +34,9 @@ import org.jboss.logging.Logger;
* <li><em>System-level</em> properties are shared by all factory instances and are always
* determined by the {@code Environment} properties.
* </ul>
* The only system-level properties are
* <ul>
* <li>{@code hibernate.jdbc.use_streams_for_binary}
* <li>{@code hibernate.cglib.use_reflection_optimizer}
* </ul>
* <p>
* The only system-level property is {@value #USE_REFLECTION_OPTIMIZER}.
* </p>
* {@code Environment} properties are populated by calling {@link System#getProperties()}
* and then from a resource named {@code /hibernate.properties} if it exists. System
* properties override properties specified in {@code hibernate.properties}.
@ -144,23 +142,11 @@ public final class Environment implements AvailableSettings {
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, Environment.class.getName());
private static final BytecodeProvider BYTECODE_PROVIDER_INSTANCE;
private static final boolean ENABLE_BINARY_STREAMS;
private static final boolean ENABLE_REFLECTION_OPTIMIZER;
private static final boolean ENABLE_LEGACY_PROXY_CLASSNAMES;
private static final Properties GLOBAL_PROPERTIES;
/**
* No longer effective.
*
* @param configurationValues The specified properties.
* @deprecated without replacement. Such verification is best done ad hoc, case by case.
*/
@Deprecated
public static void verifyProperties(Map<?,?> configurationValues) {
//Obsolete and Renamed properties are no longer handled here
}
static {
Version.logVersion();
@ -202,11 +188,6 @@ public final class Environment implements AvailableSettings {
LOG.unableToCopySystemProperties();
}
ENABLE_BINARY_STREAMS = ConfigurationHelper.getBoolean(USE_STREAMS_FOR_BINARY, GLOBAL_PROPERTIES);
if ( ENABLE_BINARY_STREAMS ) {
LOG.usingStreams();
}
ENABLE_REFLECTION_OPTIMIZER = ConfigurationHelper.getBoolean(USE_REFLECTION_OPTIMIZER, GLOBAL_PROPERTIES);
if ( ENABLE_REFLECTION_OPTIMIZER ) {
LOG.usingReflectionOptimizer();
@ -232,24 +213,6 @@ public final class Environment implements AvailableSettings {
return false;
}
/**
* Should we use streams to bind binary types to JDBC IN parameters?
*
* @return True if streams should be used for binary data handling; false otherwise.
*
* @see #USE_STREAMS_FOR_BINARY
*
* @deprecated Deprecated to indicate that the method will be moved to
* {@link org.hibernate.boot.spi.SessionFactoryOptions} /
* {@link org.hibernate.boot.SessionFactoryBuilder} - probably in 6.0.
* See <a href="https://hibernate.atlassian.net/browse/HHH-12194">HHH-12194</a> and
* <a href="https://hibernate.atlassian.net/browse/HHH-12193">HHH-12193</a> for details
*/
@Deprecated
public static boolean useStreamsForBinary() {
return ENABLE_BINARY_STREAMS;
}
/**
* Should we use reflection optimization?
*

View File

@ -281,8 +281,6 @@ public abstract class Dialect implements ConversionContext {
protected void initDefaultProperties() {
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE,
Integer.toString( getDefaultStatementBatchSize() ) );
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY,
Boolean.toString( getDefaultUseStreamsForBinary() ) );
getDefaultProperties().setProperty( Environment.NON_CONTEXTUAL_LOB_CREATION,
Boolean.toString( getDefaultNonContextualLobCreation() ) );
getDefaultProperties().setProperty( Environment.USE_GET_GENERATED_KEYS,
@ -1276,14 +1274,6 @@ public abstract class Dialect implements ConversionContext {
return 1;
}
/**
* The default value to use for the configuration property
* {@value Environment#USE_STREAMS_FOR_BINARY}.
*/
public boolean getDefaultUseStreamsForBinary() {
return false;
}
/**
* The default value to use for the configuration property
* {@value Environment#NON_CONTEXTUAL_LOB_CREATION}.

View File

@ -609,11 +609,6 @@ public class OracleDialect extends Dialect {
return 15;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return true;
}
@Override
public boolean getDefaultUseGetGeneratedKeys() {
// Oracle driver reports to support getGeneratedKeys(), but they only

View File

@ -1376,9 +1376,9 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Using bytecode reflection optimizer", id = 406)
void usingReflectionOptimizer();
@LogMessage(level = INFO)
@Message(value = "Using java.io streams to persist binary types", id = 407)
void usingStreams();
// @LogMessage(level = INFO)
// @Message(value = "Using java.io streams to persist binary types", id = 407)
// void usingStreams();
@LogMessage(level = WARN)
@Message(value = "Using %s which does not generate IETF RFC 4122 compliant UUID values; consider using %s instead",

View File

@ -220,7 +220,7 @@ public final class FastSessionServices {
//Other highly useful constants:
this.dialect = jdbcServices.getJdbcEnvironment().getDialect();
this.disallowOutOfTransactionUpdateOperations = !sessionFactoryOptions.isAllowOutOfTransactionUpdateOperations();
this.useStreamForLobBinding = Environment.useStreamsForBinary() || dialect.useInputStreamToInsertBlob();
this.useStreamForLobBinding = dialect.useInputStreamToInsertBlob();
this.preferredSqlTypeCodeForBoolean = sessionFactoryOptions.getPreferredSqlTypeCodeForBoolean();
this.defaultTimeZoneStorageStrategy = sessionFactoryOptions.getDefaultTimeZoneStorageStrategy();
this.defaultJdbcBatchSize = sessionFactoryOptions.getJdbcBatchSize();

View File

@ -18,7 +18,6 @@
<property name="hibernate.connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.region_prefix">hibernate.test</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<property name="hibernate.jdbc.batch_size">0</property>
<property name="hibernate.max_fetch_depth">3</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>

View File

@ -28,7 +28,6 @@
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region_prefix" value="hibernate.test"/>
<property name="hibernate.jdbc.use_streams_for_binary" value="true"/>
<property name="hibernate.jdbc.batch_size" value="0"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>

View File

@ -28,7 +28,6 @@
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region_prefix" value="hibernate.test"/>
<property name="hibernate.jdbc.use_streams_for_binary" value="true"/>
<property name="hibernate.jdbc.batch_size" value="0"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>

View File

@ -36,9 +36,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
annotatedClasses = LobEntity.class
)
@SessionFactory
@ServiceRegistry(
settings = @Setting(name = Environment.USE_STREAMS_FOR_BINARY, value = "true")
)
public class JpaLargeBlobTest {
protected Class<?>[] getAnnotatedClasses() {

View File

@ -17,7 +17,6 @@
<property name="hibernate.connection.url">jdbc:hsqldb:.</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.region_prefix">hibernate.test</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<property name="hibernate.jdbc.batch_size">0</property>
<property name="hibernate.max_fetch_depth">3</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>