HHH-13257 - Adds MySQL8 Spatial Dialect

This commit is contained in:
Karel Maesen 2019-03-07 21:04:25 +01:00
parent 3a4ade9799
commit b856a85520
13 changed files with 755 additions and 9 deletions

View File

@ -5,7 +5,7 @@
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
hibernate.dialect org.hibernate.spatial.dialect.mysql.MySQL56SpatialDialect
hibernate.dialect org.hibernate.spatial.dialect.mysql.MySQL8SpatialDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://localhost:3306/hibern8
hibernate.connection.username hibernateormtest

View File

@ -48,13 +48,13 @@ public class MySQL56SpatialDialect extends MySQL55Dialect implements SpatialDial
MySQLGeometryTypeDescriptor.INSTANCE.getSqlType(),
"GEOMETRY"
);
final MySQLSpatialFunctions functionsToRegister = overrideObjectShapeFunctions( new MySQLSpatialFunctions() );
final MySQL5SpatialFunctions functionsToRegister = overrideObjectShapeFunctions( new MySQL5SpatialFunctions() );
for ( Map.Entry<String, SQLFunction> entry : functionsToRegister ) {
registerFunction( entry.getKey(), entry.getValue() );
}
}
private MySQLSpatialFunctions overrideObjectShapeFunctions(MySQLSpatialFunctions mysqlFunctions) {
private MySQL5SpatialFunctions overrideObjectShapeFunctions(MySQL5SpatialFunctions mysqlFunctions) {
mysqlFunctions.put( "contains", new StandardSQLFunction( "ST_Contains", StandardBasicTypes.BOOLEAN ) );
mysqlFunctions.put( "crosses", new StandardSQLFunction( "ST_Crosses", StandardBasicTypes.BOOLEAN ) );
mysqlFunctions.put( "disjoint", new StandardSQLFunction( "ST_Disjoint", StandardBasicTypes.BOOLEAN ) );

View File

@ -37,7 +37,7 @@ public class MySQL5SpatialDialect extends MySQL5Dialect implements SpatialDialec
MySQLGeometryTypeDescriptor.INSTANCE.getSqlType(),
"GEOMETRY"
);
for ( Map.Entry<String, SQLFunction> entry : new MySQLSpatialFunctions() ) {
for ( Map.Entry<String, SQLFunction> entry : new MySQL5SpatialFunctions() ) {
registerFunction( entry.getKey(), entry.getValue() );
}
}

View File

@ -11,13 +11,13 @@ import org.hibernate.spatial.dialect.SpatialFunctionsRegistry;
import org.hibernate.type.StandardBasicTypes;
/**
* An {@code Iterable} over the spatial functions supported by MySQL.
* An {@code Iterable} over the spatial functions supported by MySQL 5.x.
*
* @author Karel Maesen, Geovise BVBA
*/
class MySQLSpatialFunctions extends SpatialFunctionsRegistry {
class MySQL5SpatialFunctions extends SpatialFunctionsRegistry {
MySQLSpatialFunctions() {
MySQL5SpatialFunctions() {
functionMap.put(
"dimension", new StandardSQLFunction(
"dimension",

View File

@ -0,0 +1,124 @@
/*
* 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.mysql;
import java.util.Map;
import org.hibernate.HibernateException;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.dialect.MySQL8Dialect;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
import org.hibernate.spatial.GeolatteGeometryType;
import org.hibernate.spatial.JTSGeometryJavaTypeDescriptor;
import org.hibernate.spatial.JTSGeometryType;
import org.hibernate.spatial.SpatialDialect;
import org.hibernate.spatial.SpatialFunction;
import org.hibernate.spatial.SpatialRelation;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
/**
* Created by Karel Maesen, Geovise BVBA on 2019-03-07.
*/
public class MySQL8SpatialDialect extends MySQL8Dialect implements SpatialDialect {
private MySQLSpatialDialect dialectDelegate = new MySQLSpatialDialect();
private MySQL8SpatialFunctions spatialFunctions = new MySQL8SpatialFunctions();
/**
* Constructs an instance
*/
public MySQL8SpatialDialect() {
super();
registerColumnType(
MySQLGeometryTypeDescriptor.INSTANCE.getSqlType(),
"GEOMETRY"
);
for ( Map.Entry<String, SQLFunction> entry : spatialFunctions ) {
registerFunction( entry.getKey(), entry.getValue() );
}
}
@Override
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
dialectDelegate.contributeTypes( typeContributions, serviceRegistry );
}
@Override
public String getSpatialRelateSQL(String columnName, int spatialRelation) {
switch ( spatialRelation ) {
case SpatialRelation.WITHIN:
return " ST_within(" + columnName + ",?)";
case SpatialRelation.CONTAINS:
return " ST_contains(" + columnName + ", ?)";
case SpatialRelation.CROSSES:
return " ST_crosses(" + columnName + ", ?)";
case SpatialRelation.OVERLAPS:
return " ST_overlaps(" + columnName + ", ?)";
case SpatialRelation.DISJOINT:
return " ST_disjoint(" + columnName + ", ?)";
case SpatialRelation.INTERSECTS:
return " ST_intersects(" + columnName
+ ", ?)";
case SpatialRelation.TOUCHES:
return " ST_touches(" + columnName + ", ?)";
case SpatialRelation.EQUALS:
return " ST_equals(" + columnName + ", ?)";
default:
throw new IllegalArgumentException(
"Spatial relation is not known by this dialect"
);
}
}
@Override
public String getTypeName(int code, long length, int precision, int scale) throws HibernateException {
return dialectDelegate.getTypeName( code, length, precision, scale );
}
@Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
return dialectDelegate.remapSqlTypeDescriptor( sqlTypeDescriptor );
}
@Override
public String getSpatialFilterExpression(String columnName) {
return dialectDelegate.getSpatialFilterExpression( columnName );
}
@Override
public String getSpatialAggregateSQL(String columnName, int aggregation) {
return dialectDelegate.getSpatialAggregateSQL( columnName, aggregation );
}
@Override
public String getDWithinSQL(String columnName) {
return dialectDelegate.getDWithinSQL( columnName );
}
@Override
public String getHavingSridSQL(String columnName) {
return " (ST_SRID(" + columnName + ") = ?) ";
}
@Override
public String getIsEmptySQL(String columnName, boolean isEmpty) {
final String emptyExpr = " ST_IsEmpty(" + columnName + ") ";
return isEmpty ? emptyExpr : "( NOT " + emptyExpr + ")";
}
@Override
public boolean supportsFiltering() {
return true;
}
@Override
public boolean supports(SpatialFunction function) {
return spatialFunctions.get( function.toString() ) != null;
}
}

View File

@ -0,0 +1,174 @@
/*
* 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.mysql;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.spatial.dialect.SpatialFunctionsRegistry;
import org.hibernate.type.StandardBasicTypes;
/**
* An {@code Iterable} over the spatial functions supported by MySQL 8.
*
* @author Karel Maesen, Geovise BVBA
*/
class MySQL8SpatialFunctions extends SpatialFunctionsRegistry {
MySQL8SpatialFunctions() {
functionMap.put(
"dimension", new StandardSQLFunction(
"ST_Dimension",
StandardBasicTypes.INTEGER
)
);
functionMap.put(
"geometrytype", new StandardSQLFunction(
"ST_GeometryType", StandardBasicTypes.STRING
)
);
functionMap.put(
"srid", new StandardSQLFunction(
"ST_SRID",
StandardBasicTypes.INTEGER
)
);
functionMap.put(
"envelope", new StandardSQLFunction(
"ST_Envelope"
)
);
functionMap.put(
"astext", new StandardSQLFunction(
"ST_Astext",
StandardBasicTypes.STRING
)
);
functionMap.put(
"asbinary", new StandardSQLFunction(
"ST_Asbinary",
StandardBasicTypes.BINARY
)
);
functionMap.put(
"isempty", new StandardSQLFunction(
"ST_IsEmpty",
StandardBasicTypes.BOOLEAN
)
);
functionMap.put(
"issimple", new StandardSQLFunction(
"ST_IsSimple",
StandardBasicTypes.BOOLEAN
)
);
// functionMap.put(
// "boundary", new StandardSQLFunction(
// "boundary"
// )
// );
// Register functions for spatial relation constructs
functionMap.put(
"overlaps", new StandardSQLFunction(
"ST_Overlaps",
StandardBasicTypes.BOOLEAN
)
);
functionMap.put(
"intersects", new StandardSQLFunction(
"ST_Intersects",
StandardBasicTypes.BOOLEAN
)
);
functionMap.put(
"equals", new StandardSQLFunction(
"ST_Equals",
StandardBasicTypes.BOOLEAN
)
);
functionMap.put(
"contains", new StandardSQLFunction(
"ST_Contains",
StandardBasicTypes.BOOLEAN
)
);
functionMap.put(
"crosses", new StandardSQLFunction(
"ST_Crosses",
StandardBasicTypes.BOOLEAN
)
);
functionMap.put(
"disjoint", new StandardSQLFunction(
"ST_Disjoint",
StandardBasicTypes.BOOLEAN
)
);
functionMap.put(
"touches", new StandardSQLFunction(
"ST_Touches",
StandardBasicTypes.BOOLEAN
)
);
functionMap.put(
"within", new StandardSQLFunction(
"ST_Within",
StandardBasicTypes.BOOLEAN
)
);
// functionMap.put(
// "relate", new StandardSQLFunction(
// "relate",
// StandardBasicTypes.BOOLEAN
// )
// );
//
// register the spatial analysis functions
functionMap.put(
"distance", new StandardSQLFunction(
"ST_Distance",
StandardBasicTypes.DOUBLE
)
);
functionMap.put(
"buffer", new StandardSQLFunction(
"ST_Buffer"
)
);
functionMap.put(
"convexhull", new StandardSQLFunction(
"ST_ConvexHull"
)
);
functionMap.put(
"difference", new StandardSQLFunction(
"ST_Difference"
)
);
functionMap.put(
"intersection", new StandardSQLFunction(
"ST_Intersection"
)
);
functionMap.put(
"symdifference", new StandardSQLFunction(
"ST_SymDifference"
)
);
functionMap.put(
"geomunion", new StandardSQLFunction(
"ST_Union"
)
);
}
}

View File

@ -36,7 +36,7 @@ public class MySQLSpatialDialect extends MySQLDialect implements SpatialDialect
MySQLGeometryTypeDescriptor.INSTANCE.getSqlType(),
"GEOMETRY"
);
for ( Map.Entry<String, SQLFunction> entry : new MySQLSpatialFunctions() ) {
for ( Map.Entry<String, SQLFunction> entry : new MySQL5SpatialFunctions() ) {
registerFunction( entry.getKey(), entry.getValue() );
}
}

View File

@ -14,6 +14,7 @@ import org.hibernate.spatial.testing.dialects.db2.DB2TestSupport;
import org.hibernate.spatial.testing.dialects.h2geodb.GeoDBTestSupport;
import org.hibernate.spatial.testing.dialects.hana.HANATestSupport;
import org.hibernate.spatial.testing.dialects.mysql.MySQL56TestSupport;
import org.hibernate.spatial.testing.dialects.mysql.MySQL8TestSupport;
import org.hibernate.spatial.testing.dialects.mysql.MySQLTestSupport;
import org.hibernate.spatial.testing.dialects.oracle.OracleSDOTestSupport;
import org.hibernate.spatial.testing.dialects.postgis.PostgisTestSupport;
@ -55,6 +56,11 @@ public class TestSupportFactories {
"org.hibernate.spatial.dialect.mysql.MySQL5InnoDBSpatialDialect".equals( canonicalName ) ) {
return MySQLTestSupport.class;
}
if ( "org.hibernate.spatial.dialect.mysql.MySQL8SpatialDialect".equals( canonicalName ) ) {
return MySQL8TestSupport.class;
}
if ( "org.hibernate.spatial.dialect.mysql.MySQL56SpatialDialect".equals( canonicalName ) ||
"org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect".equals( canonicalName ) ) {
return MySQL56TestSupport.class;

View File

@ -0,0 +1,246 @@
/*
* 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.mysql;
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
import org.hibernate.spatial.testing.DataSourceUtils;
import org.hibernate.spatial.testing.NativeSQLStatement;
import org.geolatte.geom.ByteBuffer;
import org.geolatte.geom.codec.Wkb;
import org.geolatte.geom.codec.WkbDecoder;
import org.geolatte.geom.jts.JTS;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;
/**
* @author Karel Maesen, Geovise BVBA
* creation-date: 10/9/13
*/
public class MySQL8ExpectationsFactory extends AbstractExpectationsFactory {
MySQL8ExpectationsFactory(DataSourceUtils dataSourceUtils) {
super( dataSourceUtils );
}
@Override
protected NativeSQLStatement createNativeTouchesStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Touches(t.geom, ST_GeomFromText(?, 31370)) from geomtest t where ST_Touches(t.geom, ST_geomFromText(?, 31370)) = 1 ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeOverlapsStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_overlaps(t.geom, ST_GeomFromText(?, 31370)) from geomtest t where ST_Overlaps(t.geom, ST_geomFromText(?, 31370)) = 1 ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeIntersectsStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Intersects(t.geom, ST_GeomFromText(?, 31370)) from geomtest t where ST_Intersects(t.geom, ST_GeomFromText(?, 31370)) = 1 ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeWithinStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Within(t.geom, ST_GeomFromText(?, 31370)) from geomtest t where ST_Within(t.geom, ST_GeomFromText(?, 31370)) = 1 ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeEqualsStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Equals(t.geom, ST_GeomFromText(?, 31370)) from geomtest t where ST_Equals(t.geom, ST_GeomFromText(?, 31370)) = 1 ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeCrossesStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Crosses(t.geom, ST_GeomFromText(?, 31370)) from geomtest t where ST_Crosses(t.geom, ST_geomFromText(?, 31370)) = 1 ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeContainsStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Contains(t.geom, ST_GeomFromText(?, 31370)) from geomtest t where ST_Contains(t.geom, ST_geomFromText(?, 31370)) = 1 ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeDisjointStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Disjoint(t.geom, ST_GeomFromText(?, 31370)) from geomtest t where ST_Disjoint(t.geom, ST_geomFromText(?, 31370)) = 1 ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeRelateStatement(Geometry geom, String matrix) {
throw new UnsupportedOperationException();
}
@Override
protected NativeSQLStatement createNativeDwithinStatement(Point geom, double distance) {
throw new UnsupportedOperationException();
}
@Override
protected NativeSQLStatement createNativeFilterStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, MBRIntersects(t.geom, ST_GeomFromtext(?, 31370)) from geomtest t where MBRIntersects(t.geom, ST_GeomFromtext(?, 31370)) = 1",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeDistanceStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_distance(t.geom, ST_GeomFromText(?, 31370)) from geomtest t ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeDimensionSQL() {
return createNativeSQLStatement( "select id, ST_dimension(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeBufferStatement(Double distance) {
return createNativeSQLStatement(
"select t.id, ST_buffer(t.geom,?) from geomtest t ",
new Object[] { distance }
);
}
@Override
protected NativeSQLStatement createNativeConvexHullStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_convexhull(ST_Union(t.geom, ST_GeomFromText(?, 31370))) from geomtest t",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeIntersectionStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_intersection(t.geom, ST_GeomFromtext(?, 31370)) from geomtest t ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeDifferenceStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Difference(t.geom, ST_GeomFromtext(?, 31370)) from geomtest t ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeSymDifferenceStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Symdifference(t.geom, ST_GeomFromtext(?, 31370)) from geomtest t ",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeGeomUnionStatement(Geometry geom) {
return createNativeSQLStatementAllWKTParams(
"select t.id, ST_Union(t.geom, ST_GeomFromtext(?, 31370)) from geomtest t",
geom.toText()
);
}
@Override
protected NativeSQLStatement createNativeAsTextStatement() {
return createNativeSQLStatement( "select id, ST_astext(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeSridStatement() {
return createNativeSQLStatement( "select id, ST_SRID(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeIsSimpleStatement() {
return createNativeSQLStatement( "select id, ST_IsSimple(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeIsEmptyStatement() {
return createNativeSQLStatement( "select id, ST_IsEmpty(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeIsNotEmptyStatement() {
return createNativeSQLStatement( "select id, not ST_IsEmpty(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeBoundaryStatement() {
throw new UnsupportedOperationException();
}
@Override
protected NativeSQLStatement createNativeEnvelopeStatement() {
return createNativeSQLStatement( "select id, ST_Envelope(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeAsBinaryStatement() {
return createNativeSQLStatement( "select id, ST_AsBinary(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeGeometryTypeStatement() {
return createNativeSQLStatement( "select id, ST_GeometryType(geom) from geomtest" );
}
@Override
protected NativeSQLStatement createNativeTransformStatement(int epsg) {
throw new UnsupportedOperationException();
}
@Override
protected NativeSQLStatement createNativeHavingSRIDStatement(int srid) {
return createNativeSQLStatement( "select t.id, (ST_Srid(t.geom) = " + srid + ") from geomtest t where ST_SRID(t.geom) = " + srid );
}
@Override
protected Geometry decode(Object bytes) {
if ( bytes == null ) {
return null;
}
ByteBuffer buffer = ByteBuffer.from( (byte[]) bytes );
WkbDecoder decoder = Wkb.newDecoder( Wkb.Dialect.MYSQL_WKB );
return JTS.to( decoder.decode( buffer ) );
}
@Override
public int getTestSrid() {
return 31370;
}
}

View File

@ -0,0 +1,30 @@
/*
* 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.mysql;
import org.hibernate.spatial.testing.TestDataElement;
import org.hibernate.spatial.testing.WktUtility;
/**
* Created by Karel Maesen, Geovise BVBA on 2019-03-07.
*/
public class MySQL8ExpressionTemplate extends MySQLExpressionTemplate {
static final String SQL_TEMPLATE = "insert into geomtest (id, type, geom) values (%d, '%s', ST_GeomFromText('%s', %d))";
public String toInsertSql(TestDataElement testDataElement) {
String wkt = WktUtility.getWkt( testDataElement.wkt );
int srid = WktUtility.getSRID( testDataElement.wkt );
return String.format(
SQL_TEMPLATE,
testDataElement.id,
testDataElement.type,
wkt,
srid
);
}
}

View File

@ -0,0 +1,35 @@
/*
* 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.mysql;
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
import org.hibernate.spatial.testing.DataSourceUtils;
import org.hibernate.spatial.testing.SQLExpressionTemplate;
import org.hibernate.spatial.testing.TestData;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
/**
* Created by Karel Maesen, Geovise BVBA on 2019-03-07.
*/
public class MySQL8TestSupport extends MySQLTestSupport {
@Override
public TestData createTestData(BaseCoreFunctionalTestCase testcase) {
return TestData.fromFile( "mysql/test-mysql8-functions-data-set.xml" );
}
@Override
public SQLExpressionTemplate getSQLExpressionTemplate() {
return new MySQL8ExpressionTemplate();
}
@Override
public AbstractExpectationsFactory createExpectationsFactory(DataSourceUtils dataSourceUtils) {
return new MySQL8ExpectationsFactory( dataSourceUtils );
}
}

View File

@ -4,7 +4,6 @@
* 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.mysql;

View File

@ -0,0 +1,132 @@
<!--
~ 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>.
-->
<!--
Tests for MySQL spatial functions should not contain empty geometries.
In MySQL these are stored as null objects.
-->
<TestData>
<Element>
<id>1</id>
<type>POINT</type>
<wkt>SRID=31370;POINT(10 5)</wkt>
</Element>
<Element>
<id>2</id>
<type>POINT</type>
<wkt>SRID=31370;POINT(52.25 2.53)</wkt>
</Element>
<Element>
<id>3</id>
<type>POINT</type>
<wkt>SRID=31370;POINT(51 12)</wkt>
</Element>
<Element>
<id>4</id>
<type>POINT</type>
<wkt>SRID=31370;POINT(10.0 2.0)</wkt>
</Element>
<Element>
<id>5</id>
<type>LINESTRING</type>
<wkt>SRID=31370;LINESTRING(10.0 5.0, 20.0 15.0)</wkt>
</Element>
<Element>
<id>6</id>
<type>LINESTRING</type>
<wkt>SRID=31370;LINESTRING(10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0)</wkt>
</Element>
<Element>
<id>11</id>
<type>MULTILINESTRING</type>
<wkt>SRID=31370;MULTILINESTRING((10.0 5.0, 20.0 15.0),( 25.0 30.0, 30.0 20.0))</wkt>
</Element>
<Element>
<id>12</id>
<type>MULTILINESTRING</type>
<wkt>SRID=31370;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40 14.0))
</wkt>
</Element>
<Element>
<id>16</id>
<type>POLYGON</type>
<wkt>SRID=31370;POLYGON( (0 0, 0 10, 10 10, 10 0, 0 0) )</wkt>
</Element>
<Element>
<id>18</id>
<type>POLYGON</type>
<wkt>SRID=31370;POLYGON( (0 0, 0 10, 10 10, 10 0, 0 0), (2 2, 2 5, 5 5,5 2, 2 2))</wkt>
</Element>
<Element>
<id>19</id>
<type>POLYGON</type>
<wkt>SRID=31370;POLYGON( (50 50, 50 70, 70 70, 70 50, 50 50) )</wkt>
</Element>
<Element>
<id>20</id>
<type>MULTIPOLYGON</type>
<wkt>SRID=31370;MULTIPOLYGON( ((10 20, 30 40, 44 50, 10 20)), ((55 50, 60 70, 70 78, 55 50)) )</wkt>
</Element>
<Element>
<id>22</id>
<type>MULTIPOLYGON</type>
<wkt>SRID=31370;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((15 10, 12 14, 13
14, 15 10)) )
</wkt>
</Element>
<Element>
<id>25</id>
<type>MULTIPOINT</type>
<wkt>SRID=31370;MULTIPOINT(21 2, 25 5, 30 3)</wkt>
</Element>
<Element>
<id>26</id>
<type>MULTIPOINT</type>
<wkt>SRID=31370;MULTIPOINT(21 2)</wkt>
</Element>
<Element>
<id>30</id>
<type>GEOMETRYCOLLECTION</type>
<wkt>SRID=31370;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3))</wkt>
</Element>
<Element>
<id>31</id>
<type>GEOMETRYCOLLECTION</type>
<wkt>SRID=31370;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3), POLYGON((0 0, 3 0, 3 3,0 3, 0 0)))</wkt>
</Element>
<Element>
<id>32</id>
<type>GEOMETRYCOLLECTION</type>
<wkt>SRID=31370;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3), POLYGON((0 0, 3 0, 3 3,0 3, 0 0),(1 1, 2 1, 2 2, 1 2,
1 1)))
</wkt>
</Element>
<Element>
<id>33</id>
<type>GEOMETRYCOLLECTION</type>
<wkt>SRID=31370;GEOMETRYCOLLECTION( MULTIPOINT(21 2, 25 5, 30 3), MULTIPOLYGON( ((10 20, 30 40, 44 50, 10 20)), ((15 10,
12 14, 13 14, 15 10)) ), MULTILINESTRING((10.0 5.0, 20.0 15.0),( 25.0 30.0, 30.0 20.0)))
</wkt>
</Element>
</TestData>