clean up the Dialect-specific default property handling

This commit is contained in:
Gavin King 2021-12-15 16:01:01 +01:00
parent 057b9bfc04
commit bc65526c77
20 changed files with 217 additions and 122 deletions

View File

@ -9,7 +9,6 @@ package org.hibernate.community.dialect;
import java.sql.Types;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.community.dialect.identity.CUBRIDIdentityColumnSupport;
import org.hibernate.community.dialect.sequence.CUBRIDSequenceSupport;
import org.hibernate.community.dialect.sequence.SequenceInformationExtractorCUBRIDDatabaseImpl;
@ -76,9 +75,10 @@ public class CUBRIDDialect extends Dialect {
registerColumnType( Types.BINARY, "bit($l)" );
registerColumnType( Types.VARBINARY, getMaxVarbinaryLength(), "bit varying($l)" );
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
registerCubridKeywords();
}
private void registerCubridKeywords() {
registerKeyword( "TYPE" );
registerKeyword( "YEAR" );
registerKeyword( "MONTH" );
@ -116,6 +116,16 @@ public class CUBRIDDialect extends Dialect {
registerKeywords( info );
}
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return true;
}
@Override
public int getMaxVarcharLength() {
return 1_073_741_823;

View File

@ -71,11 +71,6 @@ public class CacheDialect extends Dialect {
registerColumnType( Types.BLOB, "image" );
registerColumnType( Types.CLOB, "text" );
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "false" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
getDefaultProperties().setProperty( Environment.USE_SQL_COMMENTS, "false" );
}
public CacheDialect(DialectResolutionInfo info) {
@ -83,6 +78,17 @@ public class CacheDialect extends Dialect {
registerKeywords( info );
}
@Override
protected void initDefaultProperties() {
super.initDefaultProperties();
getDefaultProperties().setProperty( Environment.USE_SQL_COMMENTS, "false" );
}
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
private static void useJdbcEscape(QueryEngine queryEngine, String name) {
//Yep, this seems to be truly necessary for certain functions
queryEngine.getSqmFunctionRegistry().wrapInJdbcEscape(

View File

@ -19,7 +19,6 @@ import java.util.regex.Pattern;
import org.hibernate.HibernateException;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.cfg.Environment;
import org.hibernate.community.dialect.identity.FirebirdIdentityColumnSupport;
import org.hibernate.community.dialect.pagination.SkipFirstLimitHandler;
import org.hibernate.community.dialect.sequence.FirebirdSequenceSupport;
@ -153,8 +152,6 @@ public class FirebirdDialect extends Dialect {
registerColumnType( Types.BLOB, "blob sub_type binary" );
registerColumnType( Types.CLOB, "blob sub_type text" );
registerColumnType( Types.NCLOB, "blob sub_type text" ); // Firebird doesn't have NCLOB, but Jaybird emulates NCLOB support
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
@Override
@ -174,6 +171,11 @@ public class FirebirdDialect extends Dialect {
return version;
}
@Override
public int getDefaultStatementBatchSize() {
return 0;
}
@Override
public TimeZoneSupport getTimeZoneSupport() {
return getVersion().isSameOrAfter( 4, 0 ) ? TimeZoneSupport.NATIVE : TimeZoneSupport.NONE;

View File

@ -8,7 +8,6 @@ package org.hibernate.community.dialect;
import java.sql.Types;
import org.hibernate.cfg.Environment;
import org.hibernate.community.dialect.identity.Ingres10IdentityColumnSupport;
import org.hibernate.community.dialect.identity.Ingres9IdentityColumnSupport;
import org.hibernate.community.dialect.pagination.FirstLimitHandler;
@ -144,6 +143,30 @@ public class IngresDialect extends Dialect {
registerColumnType( Types.DATE, "ansidate" );
}
limitHandler = getVersion().isBefore( 9, 3 ) ? FirstLimitHandler.INSTANCE : IngresLimitHandler.INSTANCE;
sequenceSupport = new ANSISequenceSupport() {
@Override
public boolean supportsPooledSequences() {
return getVersion().isSameOrAfter( 9, 3 );
}
};
}
// @Override
// protected void initDefaultProperties() {
// super.initDefaultProperties();
//
// if ( getVersion().isBefore( 10 ) ) {
// // There is no support for a native boolean type that accepts values
// // of true, false or unknown. Using the tinyint type requires
// // substitutions of true and false.
// getDefaultProperties().setProperty( Environment.QUERY_SUBSTITUTIONS, "true=1,false=0" );
// }
// }
@Override
public boolean getDefaultUseGetGeneratedKeys() {
// Ingres driver supports getGeneratedKeys but only in the following
// form:
// The Ingres DBMS returns only a single table key or a single object
@ -154,23 +177,7 @@ public class IngresDialect extends Dialect {
// ignored and getGeneratedKeys() returns a result-set containing no
// rows, a single row with one column, or a single row with two columns.
// Ingres JDBC Driver returns table and object keys as BINARY values.
getDefaultProperties().setProperty( Environment.USE_GET_GENERATED_KEYS, "false" );
if ( getVersion().isBefore( 10 ) ) {
// There is no support for a native boolean type that accepts values
// of true, false or unknown. Using the tinyint type requires
// substitutions of true and false.
getDefaultProperties().setProperty( Environment.QUERY_SUBSTITUTIONS, "true=1,false=0" );
}
limitHandler = getVersion().isBefore( 9, 3 ) ? FirstLimitHandler.INSTANCE : IngresLimitHandler.INSTANCE;
sequenceSupport = new ANSISequenceSupport() {
@Override
public boolean supportsPooledSequences() {
return getVersion().isSameOrAfter( 9, 3 );
}
};
return false;
}
@Override

View File

@ -10,7 +10,6 @@ import java.sql.DatabaseMetaData;
import java.sql.Types;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.cfg.Environment;
import org.hibernate.community.dialect.sequence.MaxDBSequenceSupport;
import org.hibernate.community.dialect.sequence.SequenceInformationExtractorSAPDBDatabaseImpl;
import org.hibernate.dialect.AbstractTransactSQLDialect;
@ -64,8 +63,6 @@ public class MaxDBDialect extends Dialect {
registerColumnType( Types.CLOB, "long varchar" );
registerColumnType( Types.BLOB, "long byte" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
@Override
@ -107,6 +104,11 @@ public class MaxDBDialect extends Dialect {
return ZERO_VERSION;
}
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
@Override
public LimitHandler getLimitHandler() {
return LimitOffsetLimitHandler.INSTANCE;

View File

@ -10,7 +10,6 @@ import java.sql.Types;
import org.hibernate.HibernateException;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.cfg.Environment;
import org.hibernate.community.dialect.identity.MimerSQLIdentityColumnSupport;
import org.hibernate.community.dialect.sequence.MimerSequenceSupport;
import org.hibernate.community.dialect.sequence.SequenceInformationExtractorMimerSQLDatabaseImpl;
@ -78,9 +77,6 @@ public class MimerSQLDialect extends Dialect {
registerColumnType( Types.NCLOB, "nclob($l)" );
registerColumnType( Types.TIMESTAMP_WITH_TIMEZONE, "timestamp($p)" );
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, "50" );
}
public MimerSQLDialect(DialectResolutionInfo info) {
@ -106,6 +102,16 @@ public class MimerSQLDialect extends Dialect {
return ZERO_VERSION;
}
@Override
public int getDefaultStatementBatchSize() {
return 50;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return true;
}
@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
super.initializeFunctionRegistry( queryEngine );

View File

@ -7,7 +7,6 @@
package org.hibernate.community.dialect;
import java.sql.Types;
import java.util.Map;
import org.hibernate.LockOptions;

View File

@ -115,18 +115,17 @@ public class TeradataDialect extends Dialect {
registerKeyword( "role" );
registerKeyword( "account" );
registerKeyword( "class" );
if ( getVersion().isBefore( 14 ) ) {
// use getBytes instead of getBinaryStream
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "false" );
// no batch statements
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
else {
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
@Override
public int getDefaultStatementBatchSize() {
return getVersion().isBefore( 14 )
? 0 : 15;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return getVersion().isSameOrAfter( 14 );
}
@Override

View File

@ -8,7 +8,6 @@ package org.hibernate.community.dialect;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.DatabaseVersion;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.RowLockStrategy;
@ -95,9 +94,6 @@ public class TimesTenDialect extends Dialect {
//`timestamp` has more precision than `tt_timestamp`
// registerColumnType(Types.TIMESTAMP, "tt_timestamp");
registerColumnType( Types.TIMESTAMP_WITH_TIMEZONE, "timestamp($p)" );
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
public TimesTenDialect(DialectResolutionInfo info) {
@ -110,6 +106,16 @@ public class TimesTenDialect extends Dialect {
return ZERO_VERSION;
}
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return true;
}
@Override
public JdbcType resolveSqlTypeDescriptor(
String columnTypeName,

View File

@ -13,7 +13,6 @@ import org.hibernate.boot.Metadata;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.function.CommonFunctionFactory;
import org.hibernate.dialect.identity.HANAIdentityColumnSupport;
import org.hibernate.dialect.identity.IdentityColumnSupport;
@ -215,12 +214,18 @@ public abstract class AbstractHANADialect extends Dialect {
registerColumnType( SqlTypes.POINT, "st_point" );
registerHanaKeywords();
}
@Override
public boolean getDefaultNonContextualLobCreation() {
// createBlob() and createClob() are not supported by the HANA JDBC driver
getDefaultProperties().setProperty( AvailableSettings.NON_CONTEXTUAL_LOB_CREATION, "true" );
return true;
}
@Override
public boolean getDefaultUseGetGeneratedKeys() {
// getGeneratedKeys() is not supported by the HANA JDBC driver
getDefaultProperties().setProperty( AvailableSettings.USE_GET_GENERATED_KEYS, "false" );
return false;
}
@Override

View File

@ -51,10 +51,6 @@ import static org.hibernate.type.SqlTypes.*;
*/
public abstract class AbstractTransactSQLDialect extends Dialect {
{
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
public AbstractTransactSQLDialect(DatabaseVersion version) {
super(version);
}
@ -96,6 +92,11 @@ public abstract class AbstractTransactSQLDialect extends Dialect {
}
}
@Override
public int getDefaultStatementBatchSize() {
return 0;
}
@Override
public JdbcType resolveSqlTypeDescriptor(
String columnTypeName,

View File

@ -82,10 +82,6 @@ public class DB2Dialect extends Dialect {
: DB2LimitHandler.INSTANCE;
private final UniqueDelegate uniqueDelegate = createUniqueDelegate();
{
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
public DB2Dialect() {
this( DatabaseVersion.make( 9, 0 ) );
}
@ -113,6 +109,11 @@ public class DB2Dialect extends Dialect {
registerKeyword( "only" );
}
@Override
public int getDefaultStatementBatchSize() {
return 0;
}
@Override
protected String columnType(int jdbcTypeCode) {
if ( getVersion().isBefore( 11 ) ) {

View File

@ -9,7 +9,6 @@ package org.hibernate.dialect;
import org.hibernate.HibernateException;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.CommonFunctionFactory;
import org.hibernate.dialect.function.CastingConcatFunction;
import org.hibernate.dialect.function.DerbyLpadEmulation;
@ -96,10 +95,6 @@ public class DerbyDialect extends Dialect {
? AbstractLimitHandler.NO_LIMIT
: new DerbyLimitHandler( getVersion().isSameOrAfter( 10, 6 ) );
{
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
public DerbyDialect() {
this( DatabaseVersion.make( 10, 0 ) );
}
@ -196,6 +191,11 @@ public class DerbyDialect extends Dialect {
return NationalizationSupport.IMPLICIT;
}
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
@Override
public int getFloatPrecision() {
return 23;

View File

@ -49,6 +49,7 @@ import org.hibernate.boot.model.TypeContributions;
import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
import org.hibernate.boot.model.relational.Sequence;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.CastFunction;
import org.hibernate.dialect.function.CastStrEmulation;
import org.hibernate.dialect.function.CoalesceIfnullEmulation;
@ -189,16 +190,6 @@ import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithM
*/
public abstract class Dialect implements ConversionContext {
/**
* Defines a default batch size constant
*/
public static final String DEFAULT_BATCH_SIZE = "15";
/**
* Defines a "no batching" batch size constant
*/
protected static final String NO_BATCH = "0";
/**
* Characters used as opening for quoting SQL identifiers
*/
@ -243,6 +234,7 @@ public abstract class Dialect implements ConversionContext {
registerDefaultColumnTypes();
registerHibernateTypes();
registerDefaultKeywords();
initDefaultProperties();
}
protected Dialect(DialectResolutionInfo info) {
@ -252,6 +244,21 @@ public abstract class Dialect implements ConversionContext {
registerHibernateTypes();
registerDefaultKeywords();
registerKeywords(info);
initDefaultProperties();
}
/**
* Set appropriate default values for configuration properties.
*/
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,
Boolean.toString( getDefaultUseGetGeneratedKeys() ) );
}
/**
@ -1311,6 +1318,38 @@ public abstract class Dialect implements ConversionContext {
return properties;
}
/**
* The default value to use for the configuration property
* {@link Environment#STATEMENT_BATCH_SIZE}.
*/
public int getDefaultStatementBatchSize() {
return 1;
}
/**
* The default value to use for the configuration property
* {@link Environment#USE_STREAMS_FOR_BINARY}.
*/
public boolean getDefaultUseStreamsForBinary() {
return false;
}
/**
* The default value to use for the configuration property
* {@link Environment#NON_CONTEXTUAL_LOB_CREATION}.
*/
public boolean getDefaultNonContextualLobCreation() {
return false;
}
/**
* The default value to use for the configuration property
* {@link Environment#USE_GET_GENERATED_KEYS}.
*/
public boolean getDefaultUseGetGeneratedKeys() {
return true;
}
@Override
public String toString() {
return getClass().getName();

View File

@ -12,7 +12,6 @@ import java.util.List;
import org.hibernate.PessimisticLockException;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.function.CommonFunctionFactory;
import org.hibernate.dialect.hint.IndexQueryHintHandler;
import org.hibernate.dialect.identity.H2IdentityColumnSupport;
@ -84,12 +83,6 @@ public class H2Dialect extends Dialect {
private final SequenceInformationExtractor sequenceInformationExtractor;
private final String querySequenceString;
{
getDefaultProperties().setProperty( AvailableSettings.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
// http://code.google.com/p/h2database/issues/detail?id=235
getDefaultProperties().setProperty( AvailableSettings.NON_CONTEXTUAL_LOB_CREATION, "true" );
}
public H2Dialect(DialectResolutionInfo info) {
this( parseVersion( info ) );
registerKeywords( info );
@ -151,6 +144,12 @@ public class H2Dialect extends Dialect {
return bits.length > 2 ? Integer.parseInt( bits[2] ) : 0;
}
@Override
public boolean getDefaultNonContextualLobCreation() {
// http://code.google.com/p/h2database/issues/detail?id=235
return true;
}
@Override
protected String columnType(int jdbcTypeCode) {
if ( jdbcTypeCode == NUMERIC && getVersion().isBefore(2) ) {
@ -194,6 +193,11 @@ public class H2Dialect extends Dialect {
}
}
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
public boolean hasOddDstBehavior() {
// H2 1.4.200 has a bug: https://github.com/h2database/h2database/issues/3184
return getVersion().isSame( 1, 4, 200 );

View File

@ -12,7 +12,6 @@ import java.sql.Types;
import org.hibernate.JDBCException;
import org.hibernate.LockMode;
import org.hibernate.StaleObjectStateException;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.CommonFunctionFactory;
import org.hibernate.dialect.identity.HSQLIdentityColumnSupport;
import org.hibernate.dialect.identity.IdentityColumnSupport;
@ -89,10 +88,6 @@ public class HSQLDialect extends Dialect {
HSQLDialect.class.getName()
);
{
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
public HSQLDialect(DialectResolutionInfo info) {
this( info.makeCopy() );
registerKeywords( info );
@ -143,6 +138,11 @@ public class HSQLDialect extends Dialect {
return super.columnType(jdbcTypeCode);
}
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
private static DatabaseVersion reflectedVersion(DatabaseVersion version) {
try {
final Class<?> props = ReflectHelper.classForName("org.hsqldb.persist.HsqlDatabaseProperties");

View File

@ -108,11 +108,6 @@ public class MySQLDialect extends Dialect {
}
};
{
getDefaultProperties().setProperty( Environment.MAX_FETCH_DEPTH, "2" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
private int maxVarcharLength;
private int maxVarbinaryLength;
@ -123,13 +118,18 @@ public class MySQLDialect extends Dialect {
public MySQLDialect(DatabaseVersion version) {
super(version);
registerKeyword( "key" );
}
public MySQLDialect(DialectResolutionInfo info) {
super(info);
}
@Override
protected void initDefaultProperties() {
super.initDefaultProperties();
getDefaultProperties().setProperty( Environment.MAX_FETCH_DEPTH, "2" );
}
private MySQLStorageEngine createStorageEngine() {
String storageEngine = Environment.getProperties().getProperty( Environment.STORAGE_ENGINE );
if (storageEngine == null) {

View File

@ -116,12 +116,10 @@ public class OracleDialect extends Dialect {
public OracleDialect(DatabaseVersion version) {
super(version);
registerDefaultProperties();
}
public OracleDialect(DialectResolutionInfo info) {
super(info);
registerDefaultProperties();
}
@Override
@ -592,22 +590,30 @@ public class OracleDialect extends Dialect {
return getVersion().isSameOrAfter( 9 ) ? TimeZoneSupport.NATIVE : TimeZoneSupport.NONE;
}
protected void registerDefaultProperties() {
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
@Override
protected void initDefaultProperties() {
super.initDefaultProperties();
String newerVersion = Boolean.toString( getVersion().isSameOrAfter( 12 ) );
getDefaultProperties().setProperty( Environment.BATCH_VERSIONED_DATA, newerVersion );
}
if ( getVersion().isBefore( 12 ) ) {
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
@Override
public boolean getDefaultUseStreamsForBinary() {
return true;
}
@Override
public boolean getDefaultUseGetGeneratedKeys() {
// Oracle driver reports to support getGeneratedKeys(), but they only
// support the version taking an array of the names of the columns to
// be returned (via its RETURNING clause). No other driver seems to
// support this overloaded version.
getDefaultProperties().setProperty( Environment.USE_GET_GENERATED_KEYS, "false" );
getDefaultProperties().setProperty( Environment.BATCH_VERSIONED_DATA, "false" );
}
else {
getDefaultProperties().setProperty( Environment.USE_GET_GENERATED_KEYS, "true" );
getDefaultProperties().setProperty( Environment.BATCH_VERSIONED_DATA, "true" );
}
return getVersion().isSameOrAfter( 12 );
}
@Override

View File

@ -26,7 +26,6 @@ import org.hibernate.LockOptions;
import org.hibernate.PessimisticLockException;
import org.hibernate.QueryTimeoutException;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.CommonFunctionFactory;
import org.hibernate.dialect.identity.IdentityColumnSupport;
import org.hibernate.dialect.identity.PostgreSQLIdentityColumnSupport;
@ -101,11 +100,6 @@ public class PostgreSQLDialect extends Dialect {
private final PostgreSQLDriverKind driverKind;
{
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
getDefaultProperties().setProperty( Environment.NON_CONTEXTUAL_LOB_CREATION, "true" );
}
public PostgreSQLDialect() {
this( DatabaseVersion.make( 8, 0 ) );
}
@ -125,6 +119,11 @@ public class PostgreSQLDialect extends Dialect {
this.driverKind = driverKind;
}
@Override
public boolean getDefaultNonContextualLobCreation() {
return true;
}
@Override
protected String columnType(int jdbcTypeCode) {
switch (jdbcTypeCode) {
@ -213,6 +212,11 @@ public class PostgreSQLDialect extends Dialect {
return super.getTypeName( code, size );
}
@Override
public int getDefaultStatementBatchSize() {
return 15;
}
@Override
public JdbcType resolveSqlTypeDescriptor(
String columnTypeName,

View File

@ -52,10 +52,8 @@ public class StandardJdbcMutationExecutor implements JdbcMutationExecutor {
finalSql = jdbcMutation.getSql();
}
else {
final Dialect dialect = jdbcServices.getDialect();
final String sql = jdbcMutation.getSql();
finalSql = dialect.addSqlHintOrComment(
sql,
finalSql = jdbcServices.getDialect().addSqlHintOrComment(
jdbcMutation.getSql(),
queryOptions,
executionContext.getSession().getFactory().getSessionFactoryOptions().isCommentsEnabled()
);