HHH-16221 Improve extensibility of CockroachDB and PostgreSQL dialects
This commit is contained in:
parent
87bf20f1bb
commit
b328b1a3fb
|
@ -114,8 +114,8 @@ public class CockroachLegacyDialect extends Dialect {
|
|||
|
||||
// Pre-compile and reuse pattern
|
||||
private static final Pattern CRDB_VERSION_PATTERN = Pattern.compile( "v[\\d]+(\\.[\\d]+)?(\\.[\\d]+)?" );
|
||||
private static final DatabaseVersion DEFAULT_VERSION = DatabaseVersion.make( 19, 2 );
|
||||
private final PostgreSQLDriverKind driverKind;
|
||||
protected static final DatabaseVersion DEFAULT_VERSION = DatabaseVersion.make( 19, 2 );
|
||||
protected final PostgreSQLDriverKind driverKind;
|
||||
|
||||
public CockroachLegacyDialect() {
|
||||
this( DEFAULT_VERSION );
|
||||
|
@ -322,7 +322,10 @@ public class CockroachLegacyDialect extends Dialect {
|
|||
@Override
|
||||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
contributeCockroachTypes( typeContributions, serviceRegistry );
|
||||
}
|
||||
|
||||
protected void contributeCockroachTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeRegistry();
|
||||
jdbcTypeRegistry.addDescriptor( TIMESTAMP_UTC, InstantAsTimestampWithTimeZoneJdbcType.INSTANCE );
|
||||
|
|
|
@ -156,7 +156,7 @@ public class PostgreSQLLegacyDialect extends Dialect {
|
|||
|
||||
private static final PostgreSQLIdentityColumnSupport IDENTITY_COLUMN_SUPPORT = new PostgreSQLIdentityColumnSupport();
|
||||
|
||||
private final PostgreSQLDriverKind driverKind;
|
||||
protected final PostgreSQLDriverKind driverKind;
|
||||
private final UniqueDelegate uniqueDelegate = new CreateTableUniqueDelegate(this);
|
||||
|
||||
public PostgreSQLLegacyDialect() {
|
||||
|
@ -1314,7 +1314,10 @@ public class PostgreSQLLegacyDialect extends Dialect {
|
|||
@Override
|
||||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
contributePostgreSQLTypes( typeContributions, 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
|
||||
|
|
|
@ -122,9 +122,9 @@ public class CockroachDialect extends Dialect {
|
|||
// Pre-compile and reuse pattern
|
||||
private static final Pattern CRDB_VERSION_PATTERN = Pattern.compile( "v[\\d]+(\\.[\\d]+)?(\\.[\\d]+)?" );
|
||||
|
||||
private static final DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 21, 1 );
|
||||
protected static final DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 21, 1 );
|
||||
|
||||
private final PostgreSQLDriverKind driverKind;
|
||||
protected final PostgreSQLDriverKind driverKind;
|
||||
|
||||
public CockroachDialect() {
|
||||
this( MINIMUM_VERSION );
|
||||
|
@ -333,7 +333,10 @@ public class CockroachDialect extends Dialect {
|
|||
@Override
|
||||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
contributeCockroachTypes( typeContributions, serviceRegistry );
|
||||
}
|
||||
|
||||
protected void contributeCockroachTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeRegistry();
|
||||
jdbcTypeRegistry.addDescriptor( TIMESTAMP_UTC, InstantAsTimestampWithTimeZoneJdbcType.INSTANCE );
|
||||
|
|
|
@ -136,12 +136,12 @@ import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithM
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class PostgreSQLDialect extends Dialect {
|
||||
private final static DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 10 );
|
||||
protected final static DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 10 );
|
||||
|
||||
private static final PostgreSQLIdentityColumnSupport IDENTITY_COLUMN_SUPPORT = new PostgreSQLIdentityColumnSupport();
|
||||
private final UniqueDelegate uniqueDelegate = new CreateTableUniqueDelegate(this);
|
||||
|
||||
private final PostgreSQLDriverKind driverKind;
|
||||
protected final PostgreSQLDriverKind driverKind;
|
||||
private final OptionalTableUpdateStrategy optionalTableUpdateStrategy;
|
||||
|
||||
public PostgreSQLDialect() {
|
||||
|
@ -1308,7 +1308,15 @@ public class PostgreSQLDialect extends Dialect {
|
|||
@Override
|
||||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes(typeContributions, serviceRegistry);
|
||||
contributePostgreSQLTypes(typeContributions, serviceRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
Loading…
Reference in New Issue