From 61696189f58be0ac99dc23c5ab166108d1df23fb Mon Sep 17 00:00:00 2001 From: Gavin Date: Sat, 15 Apr 2023 16:19:36 +0200 Subject: [PATCH] minor changes --- .../hibernate/dialect/PostgreSQLDialect.java | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java index dfeb5c1d77..b49b24af2e 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java @@ -616,13 +616,13 @@ public class PostgreSQLDialect extends Dialect { } /** - * Whether PostgreSQL supports `min(uuid)`/`max(uuid)` which it doesn't by default. - * Since the emulation is not very performant, this can be overridden by users which - * make sure that an aggregate function for uuid exists on their database. - * + * Whether PostgreSQL supports {@code min(uuid)}/{@code max(uuid)}, + * which it doesn't by default. Since the emulation does not perform well, + * this method may be overridden by any user who ensures that aggregate + * functions for handling uuids exist in the database. + *

* The following definitions can be used for this purpose: - * - * + *

 	 * create or replace function min(uuid, uuid)
 	 *     returns uuid
 	 *     immutable parallel safe
@@ -658,7 +658,7 @@ public class PostgreSQLDialect extends Dialect {
 	 *     parallel = safe,
 	 *     sortop = operator (>)
 	 *     );
-	 * 
+	 * 
*/ protected boolean supportsMinMaxOnUuid() { return false; @@ -986,7 +986,9 @@ public class PostgreSQLDialect extends Dialect { @Override public CallableStatementSupport getCallableStatementSupport() { - return getVersion().isSameOrAfter( 11 ) ? PostgreSQLCallableStatementSupport.INSTANCE : PostgreSQLCallableStatementSupport.V10_INSTANCE; + return getVersion().isSameOrAfter( 11 ) + ? PostgreSQLCallableStatementSupport.INSTANCE + : PostgreSQLCallableStatementSupport.V10_INSTANCE; } @Override @@ -1305,9 +1307,7 @@ public class PostgreSQLDialect extends Dialect { super.augmentRecognizedTableTypes( tableTypesList ); tableTypesList.add( "MATERIALIZED VIEW" ); - /* - PostgreSQL 10 and later adds support for Partition table. - */ + //PostgreSQL 10 and later adds support for Partition table. tableTypesList.add( "PARTITIONED TABLE" ); } @@ -1319,15 +1319,14 @@ public class PostgreSQLDialect extends Dialect { /** * Allow for extension points to override this only - * @param typeContributions - * @param serviceRegistry */ protected void contributePostgreSQLTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration() .getJdbcTypeRegistry(); - // For discussion of BLOB support in Postgres, as of 8.4, have a peek at - // http://jdbc.postgresql.org/documentation/84/binary-data.html. - // For the effects in regards to Hibernate see http://in.relation.to/15492.lace + // For discussion of BLOB support in Postgres, as of 8.4, see: + // http://jdbc.postgresql.org/documentation/84/binary-data.html + // For how this affects Hibernate, see: + // http://in.relation.to/15492.lace // Force BLOB binding. Otherwise, byte[] fields annotated // with @Lob will attempt to use @@ -1339,9 +1338,8 @@ public class PostgreSQLDialect extends Dialect { //jdbcTypeRegistry.addDescriptor( TimestampUtcAsOffsetDateTimeJdbcType.INSTANCE ); jdbcTypeRegistry.addDescriptor( XmlJdbcType.INSTANCE ); + jdbcTypeRegistry.addDescriptorIfAbsent( UUIDJdbcType.INSTANCE ); // HHH-9562 if ( driverKind == PostgreSQLDriverKind.PG_JDBC ) { - // HHH-9562 - jdbcTypeRegistry.addDescriptorIfAbsent( UUIDJdbcType.INSTANCE ); if ( PgJdbcHelper.isUsable( serviceRegistry ) ) { jdbcTypeRegistry.addDescriptorIfAbsent( PgJdbcHelper.getInetJdbcType( serviceRegistry ) ); jdbcTypeRegistry.addDescriptorIfAbsent( PgJdbcHelper.getIntervalJdbcType( serviceRegistry ) ); @@ -1356,7 +1354,6 @@ public class PostgreSQLDialect extends Dialect { } } else { - jdbcTypeRegistry.addDescriptorIfAbsent( UUIDJdbcType.INSTANCE ); jdbcTypeRegistry.addDescriptorIfAbsent( PostgreSQLCastingInetJdbcType.INSTANCE ); jdbcTypeRegistry.addDescriptorIfAbsent( PostgreSQLCastingIntervalSecondJdbcType.INSTANCE ); jdbcTypeRegistry.addDescriptorIfAbsent( PostgreSQLStructCastingJdbcType.INSTANCE );