HHH-14807 Upgrade to H6
This commit is contained in:
parent
9234aff3ec
commit
355694342d
|
@ -46,7 +46,10 @@ tasks.test {
|
|||
'cockroachdb',
|
||||
'mariadb',
|
||||
'mysql_ci',
|
||||
'mysql_docker'
|
||||
'mysql_docker',
|
||||
'oracle_docker',
|
||||
'oracle_ci',
|
||||
'oracle_rds'
|
||||
].contains( project.db )
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.hibernate.type.BasicTypeRegistry;
|
|||
public class BaseSqmFunctionDescriptors implements KeyedSqmFunctionDescriptors {
|
||||
protected final Map<FunctionKey, SqmFunctionDescriptor> map = new HashMap<>();
|
||||
|
||||
public BaseSqmFunctionDescriptors(FunctionContributions functionContributions) {
|
||||
public BaseSqmFunctionDescriptors(FunctionContributions functionContributions) {
|
||||
final BasicTypeRegistry basicTypeRegistry = functionContributions.getTypeConfiguration().getBasicTypeRegistry();
|
||||
for ( CommonSpatialFunction func : filter( CommonSpatialFunction.values() ) ) {
|
||||
final FunctionReturnTypeResolver returnTypeResolver;
|
||||
|
|
|
@ -20,9 +20,10 @@ public class HibernateSpatialConfigurationSettings implements Serializable {
|
|||
* The canonical class name of the Oracle ConnectionFinder implementation that will be used by the
|
||||
* Oracle spatial dialects
|
||||
*/
|
||||
|
||||
public static final String CONNECTION_FINDER = "hibernate.spatial.connection_finder";
|
||||
|
||||
public static final String ORACLE_OGC_STRICT = "hibernate.spatial.oracle_ogc_strict";
|
||||
|
||||
/**
|
||||
* SRID to use for the DB2 Spatial Dialects.
|
||||
*/
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.hibernate.dialect.Dialect;
|
|||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.MariaDBDialect;
|
||||
import org.hibernate.dialect.MySQLDialect;
|
||||
import org.hibernate.dialect.OracleDialect;
|
||||
import org.hibernate.dialect.PostgreSQLDialect;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
@ -23,6 +24,7 @@ import org.hibernate.spatial.dialect.cockroachdb.CockroachDbContributor;
|
|||
import org.hibernate.spatial.dialect.h2gis.H2GisDialectContributor;
|
||||
import org.hibernate.spatial.dialect.mariadb.MariaDBDialectContributor;
|
||||
import org.hibernate.spatial.dialect.mysql.MySQLDialectContributor;
|
||||
import org.hibernate.spatial.dialect.oracle.OracleDialectContributor;
|
||||
import org.hibernate.spatial.dialect.postgis.PostgisDialectContributor;
|
||||
|
||||
class ContributorResolver {
|
||||
|
@ -37,6 +39,7 @@ class ContributorResolver {
|
|||
CONTRIBUTOR_MAP.put( MariaDBDialect.class, MariaDBDialectContributor::new );
|
||||
CONTRIBUTOR_MAP.put( MySQLDialect.class, MySQLDialectContributor::new );
|
||||
CONTRIBUTOR_MAP.put( H2Dialect.class, H2GisDialectContributor::new );
|
||||
CONTRIBUTOR_MAP.put( OracleDialect.class, OracleDialectContributor::new );
|
||||
}
|
||||
|
||||
private ContributorResolver() {
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.dialect.oracle;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.boot.model.FunctionContributions;
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.boot.registry.selector.spi.StrategySelector;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.engine.config.spi.StandardConverters;
|
||||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.HSMessageLogger;
|
||||
import org.hibernate.spatial.HibernateSpatialConfigurationSettings;
|
||||
import org.hibernate.spatial.contributor.ContributorImplementor;
|
||||
import org.hibernate.spatial.dialect.SpatialFunctionsRegistry;
|
||||
|
||||
import org.geolatte.geom.codec.db.oracle.ConnectionFinder;
|
||||
import org.geolatte.geom.codec.db.oracle.OracleJDBCTypeFactory;
|
||||
|
||||
public class OracleDialectContributor implements ContributorImplementor {
|
||||
|
||||
private final ServiceRegistry serviceRegistry;
|
||||
|
||||
public OracleDialectContributor(ServiceRegistry serviceRegistry) {
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeJdbcTypes(TypeContributions typeContributions) {
|
||||
HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() );
|
||||
final ConfigurationService cfgService = getServiceRegistry().getService( ConfigurationService.class );
|
||||
final StrategySelector strategySelector = getServiceRegistry().getService( StrategySelector.class );
|
||||
|
||||
final ConnectionFinder connectionFinder = strategySelector.resolveStrategy(
|
||||
ConnectionFinder.class,
|
||||
cfgService.getSetting(
|
||||
HibernateSpatialConfigurationSettings.CONNECTION_FINDER,
|
||||
String.class,
|
||||
"org.geolatte.geom.codec.db.oracle.DefaultConnectionFinder"
|
||||
)
|
||||
);
|
||||
|
||||
HSMessageLogger.LOGGER.connectionFinder( connectionFinder.getClass().getCanonicalName() );
|
||||
|
||||
SDOGeometryType sdoGeometryType = new SDOGeometryType(
|
||||
new OracleJDBCTypeFactory(
|
||||
connectionFinder
|
||||
)
|
||||
);
|
||||
|
||||
typeContributions.contributeJdbcTypeDescriptor( sdoGeometryType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeFunctions(FunctionContributions functionContributions) {
|
||||
HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() );
|
||||
final var cfgService = getServiceRegistry().getService( ConfigurationService.class );
|
||||
boolean isOgcStrict = cfgService.getSetting(
|
||||
HibernateSpatialConfigurationSettings.ORACLE_OGC_STRICT,
|
||||
StandardConverters.BOOLEAN,
|
||||
false
|
||||
);
|
||||
OracleSDOSupport sdoSupport = new OracleSDOSupport( isOgcStrict );
|
||||
SpatialFunctionsRegistry entries = sdoSupport.functionsToRegister();
|
||||
for( Map.Entry<String, SqmFunctionDescriptor> funcToRegister : entries ) {
|
||||
functionContributions.getFunctionRegistry().register( funcToRegister.getKey(), funcToRegister.getValue() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServiceRegistry getServiceRegistry() {
|
||||
return serviceRegistry;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.dialect.oracle;
|
||||
|
||||
public class OracleSDOSqmFunctionDescriptors {
|
||||
}
|
|
@ -15,6 +15,7 @@ import org.hibernate.spatial.SpatialDialect;
|
|||
*
|
||||
* @author Karel Maesen
|
||||
*/
|
||||
@Deprecated
|
||||
public class OracleSpatial10gDialect extends Oracle10gDialect implements SpatialDialect {
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.hibernate.spatial.SpatialDialect;
|
|||
* <p>
|
||||
* Created by Karel Maesen, Geovise BVBA on 11/02/17.
|
||||
*/
|
||||
@Deprecated
|
||||
public class OracleSpatialSDO10gDialect extends Oracle10gDialect
|
||||
implements SpatialDialect {
|
||||
}
|
||||
|
|
|
@ -9,12 +9,15 @@ package org.hibernate.spatial.dialect.oracle;
|
|||
|
||||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.spatial.GeometryLiteralFormatter;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import org.hibernate.type.descriptor.ValueBinder;
|
||||
import org.hibernate.type.descriptor.ValueExtractor;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
|
||||
import org.geolatte.geom.codec.Wkt;
|
||||
import org.geolatte.geom.codec.db.oracle.OracleJDBCTypeFactory;
|
||||
|
||||
/**
|
||||
|
@ -46,8 +49,13 @@ public class SDOGeometryType implements JdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueBinder<X> getBinder(final JavaType<X> javaType) {
|
||||
return (ValueBinder<X>) new SDOGeometryValueBinder( javaType, this, typeFactory );
|
||||
public <T> JdbcLiteralFormatter<T> getJdbcLiteralFormatter(JavaType<T> javaTypeDescriptor) {
|
||||
return new GeometryLiteralFormatter<T>( javaTypeDescriptor, Wkt.Dialect.SFA_1_1_0, "ST_GeomFromText" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueBinder<X> getBinder(final JavaType<X> javaTypeDescriptor) {
|
||||
return (ValueBinder<X>) new SDOGeometryValueBinder( javaTypeDescriptor, this, typeFactory );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -72,10 +72,10 @@ public class SDOGeometryValueExtractor<X> extends BasicExtractor<X> {
|
|||
return null;
|
||||
}
|
||||
final SDOGeometry sdogeom = SDOGeometry.load( (Struct) struct );
|
||||
return toGeomerty( sdogeom );
|
||||
return toGeometry( sdogeom );
|
||||
}
|
||||
|
||||
private Geometry toGeomerty(SDOGeometry sdoGeom) {
|
||||
private Geometry toGeometry(SDOGeometry sdoGeom) {
|
||||
return Decoders.decode( sdoGeom );
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.hibernate.dialect.Dialect;
|
|||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.MariaDBDialect;
|
||||
import org.hibernate.dialect.MySQLDialect;
|
||||
import org.hibernate.dialect.OracleDialect;
|
||||
import org.hibernate.dialect.PostgreSQLDialect;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DialectFeatureCheck;
|
||||
|
@ -29,6 +30,7 @@ public class IsSupportedBySpatial implements DialectFeatureCheck {
|
|||
|| dialect instanceof CockroachDialect
|
||||
|| dialect instanceof MySQLDialect
|
||||
|| dialect instanceof MariaDBDialect
|
||||
|| dialect instanceof OracleDialect
|
||||
|| dialect instanceof H2Dialect;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.hibernate.dialect.Dialect;
|
|||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.MariaDBDialect;
|
||||
import org.hibernate.dialect.MySQLDialect;
|
||||
import org.hibernate.dialect.OracleDialect;
|
||||
import org.hibernate.dialect.PostgreSQLDialect;
|
||||
import org.hibernate.spatial.testing.datareader.TestSupport;
|
||||
import org.hibernate.spatial.testing.dialects.cockroachdb.CockroachDBTestSupport;
|
||||
|
@ -66,6 +67,10 @@ public class TestSupportFactories {
|
|||
return H2GisTestSupport.class;
|
||||
}
|
||||
|
||||
if ( OracleDialect.class.isAssignableFrom( dialect.getClass() ) ) {
|
||||
return OracleSDOTestSupport.class;
|
||||
}
|
||||
|
||||
if ( "org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect".equals( canonicalName ) ) {
|
||||
return SQLServerTestSupport.class;
|
||||
}
|
||||
|
@ -73,10 +78,7 @@ public class TestSupportFactories {
|
|||
return SQLServerTestSupport.class;
|
||||
}
|
||||
|
||||
if ( "org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect".equals( canonicalName ) ||
|
||||
"org.hibernate.spatial.dialect.oracle.OracleSpatialSDO10gDialect".equals( canonicalName ) ) {
|
||||
return OracleSDOTestSupport.class;
|
||||
}
|
||||
|
||||
if ( "org.hibernate.spatial.dialect.hana.HANASpatialDialect".equals( canonicalName ) ) {
|
||||
return HANATestSupport.class;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.oracle;
|
||||
|
||||
import org.hibernate.spatial.testing.dialects.NativeSQLTemplates;
|
||||
|
||||
public class OracleSDONativeSqlTemplates extends NativeSQLTemplates {
|
||||
}
|
|
@ -8,9 +8,18 @@
|
|||
package org.hibernate.spatial.testing.dialects.oracle;
|
||||
|
||||
|
||||
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.spatial.CommonSpatialFunction;
|
||||
import org.hibernate.spatial.GeomCodec;
|
||||
import org.hibernate.spatial.testing.datareader.TestData;
|
||||
import org.hibernate.spatial.testing.datareader.TestSupport;
|
||||
import org.hibernate.spatial.testing.dialects.NativeSQLTemplates;
|
||||
import org.hibernate.spatial.testing.dialects.PredicateRegexes;
|
||||
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.codec.db.oracle.Decoders;
|
||||
import org.geolatte.geom.codec.db.oracle.SDOGeometry;
|
||||
|
||||
/**
|
||||
* @author Karel Maesen, Geovise BVBA
|
||||
|
@ -18,9 +27,28 @@ import org.hibernate.spatial.testing.datareader.TestSupport;
|
|||
*/
|
||||
public class OracleSDOTestSupport extends TestSupport {
|
||||
|
||||
@Override
|
||||
public NativeSQLTemplates templates() {
|
||||
return new OracleSDONativeSqlTemplates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PredicateRegexes predicateRegexes() {
|
||||
return new PredicateRegexes( "st_" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TestData createTestData(TestDataPurpose purpose) {
|
||||
return TestData.fromFile( "oracle10g/test-sdo-geometry-data-set-2D.xml", new SDOTestDataReader() );
|
||||
}
|
||||
|
||||
public GeomCodec codec() {
|
||||
return new GeomCodec() {
|
||||
@Override
|
||||
public Geometry<?> toGeometry(Object in) {
|
||||
return Decoders.decode( (SDOGeometry) in );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue