HHH-14800 Implements suggestions from code review

- set version in deprecated Postgis dialects
- fast path for Contributor resolution
- add TODO label for Ignored tests
This commit is contained in:
Karel Maesen 2021-09-20 19:01:53 +02:00
parent cf854c5cfc
commit 3995c644d1
7 changed files with 14 additions and 11 deletions

View File

@ -192,7 +192,7 @@ The `GEOGRAPHY` type is not currently supported.
==== ====
CockroachDB:: CockroachDB::
The dialect `CockroachDB202` support the `GEOMETRY` type in CockroachDB v20.2 and later. The dialect `CockroachDB` support the `GEOMETRY` type in CockroachDB v20.2 and later.
[NOTE] [NOTE]
==== ====

View File

@ -29,9 +29,6 @@ public interface HSMessageLogger extends BasicLogger {
HSMessageLogger LOGGER = Logger.getMessageLogger( HSMessageLogger.class, LOGGER_NAME ); HSMessageLogger LOGGER = Logger.getMessageLogger( HSMessageLogger.class, LOGGER_NAME );
boolean TRACE_ENABLED = LOGGER.isTraceEnabled();
boolean DEBUG_ENABLED = LOGGER.isDebugEnabled();
@LogMessage(level = INFO) @LogMessage(level = INFO)
@Message(value = "hibernate-spatial integration enabled : %s", id = 80000001) @Message(value = "hibernate-spatial integration enabled : %s", id = 80000001)
void spatialEnabled(boolean enabled); void spatialEnabled(boolean enabled);

View File

@ -37,9 +37,15 @@ class ContributorResolver {
static ContributorImplementor resolveSpatialtypeContributorImplementor(ServiceRegistry serviceRegistry) { static ContributorImplementor resolveSpatialtypeContributorImplementor(ServiceRegistry serviceRegistry) {
JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
Dialect dialect = jdbcServices.getDialect(); Dialect dialect = jdbcServices.getDialect();
for ( Class<?> dialectClass : CONTRIBUTOR_MAP.keySet() ) { Function<ServiceRegistry, ContributorImplementor> creator =
if ( dialectClass.isAssignableFrom( dialect.getClass() ) ) { CONTRIBUTOR_MAP.get( dialect.getClass() );
return CONTRIBUTOR_MAP.get( dialectClass ).apply( serviceRegistry ); if ( creator != null ) {
creator.apply( serviceRegistry );
}
for ( Map.Entry<Class<? extends Dialect>, Function<ServiceRegistry, ContributorImplementor>> entry :
CONTRIBUTOR_MAP.entrySet() ) {
if ( entry.getKey().isAssignableFrom( dialect.getClass() ) ) {
return entry.getValue().apply( serviceRegistry );
} }
} }
return null; return null;

View File

@ -22,7 +22,7 @@ public class PostgisPG10Dialect extends PostgreSQLDialect {
} }
public PostgisPG10Dialect() { public PostgisPG10Dialect() {
super( 100 ); super( 1000 );
} }
} }

View File

@ -23,7 +23,7 @@ public class PostgisPG93Dialect extends PostgreSQLDialect {
} }
public PostgisPG93Dialect() { public PostgisPG93Dialect() {
super(); super( 930 );
} }
public PostgisPG93Dialect(int version) { public PostgisPG93Dialect(int version) {

View File

@ -23,7 +23,7 @@ public class PostgisPG94Dialect extends PostgreSQLDialect {
} }
public PostgisPG94Dialect() { public PostgisPG94Dialect() {
super(); super( 940 );
} }
public PostgisPG94Dialect(int version) { public PostgisPG94Dialect(int version) {

View File

@ -32,7 +32,7 @@ import org.locationtech.jts.io.WKBWriter;
import org.locationtech.jts.io.WKTWriter; import org.locationtech.jts.io.WKTWriter;
import static java.lang.String.format; import static java.lang.String.format;
//TODO - see what tests are still needed, when we update/fix the HANA spatial support
@RequiresDialect(value = HANASpatialDialect.class, comment = "This test tests the HANA spatial functions not covered by Hibernate Spatial", jiraKey = "HHH-12426") @RequiresDialect(value = HANASpatialDialect.class, comment = "This test tests the HANA spatial functions not covered by Hibernate Spatial", jiraKey = "HHH-12426")
@Ignore @Ignore
@Deprecated @Deprecated