HHH-10211 - Fix serialization of Postgis dialects
This commit is contained in:
parent
d1f22d490c
commit
c3b1a39944
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.spatial.dialect;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
@ -18,15 +19,15 @@ import org.hibernate.dialect.function.StandardSQLFunction;
|
|||
*
|
||||
* Created by Karel Maesen, Geovise BVBA on 29/10/16.
|
||||
*/
|
||||
public abstract class SpatialFunctionsRegistry implements Iterable<Map.Entry<String, StandardSQLFunction>> {
|
||||
protected final Map<String, StandardSQLFunction> functionMap = new HashMap<String, StandardSQLFunction>();
|
||||
public abstract class SpatialFunctionsRegistry implements Iterable<Map.Entry<String, SQLFunction>>, Serializable {
|
||||
protected final Map<String, SQLFunction> functionMap = new HashMap<String, SQLFunction>();
|
||||
|
||||
public void put(String name, StandardSQLFunction function ) {
|
||||
this.functionMap.put( name, function );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Map.Entry<String, StandardSQLFunction>> iterator() {
|
||||
public Iterator<Map.Entry<String, SQLFunction>> iterator() {
|
||||
return functionMap.entrySet().iterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.Map;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.MySQL5Dialect;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
|
@ -48,7 +49,7 @@ public class MySQL56SpatialDialect extends MySQL5Dialect implements SpatialDiale
|
|||
"GEOMETRY"
|
||||
);
|
||||
final MySQLSpatialFunctions functionsToRegister = overrideObjectShapeFunctions( new MySQLSpatialFunctions() );
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : functionsToRegister ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : functionsToRegister ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Map;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.MySQL5InnoDBDialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
@ -36,7 +36,7 @@ public class MySQL5InnoDBSpatialDialect extends MySQL5InnoDBDialect implements S
|
|||
MySQLGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : new MySQLSpatialFunctions() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : new MySQLSpatialFunctions() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.MySQLDialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
import org.hibernate.spatial.JTSGeometryType;
|
||||
|
@ -35,7 +34,7 @@ public class MySQLSpatialDialect extends MySQLDialect implements SpatialDialect
|
|||
MySQLGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : new MySQLSpatialFunctions() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : new MySQLSpatialFunctions() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,20 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
||||
/**
|
||||
* Extends the {@code PostgreSQL82Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
*
|
||||
* Extends the {@code PostgreSQL82Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
* <p>
|
||||
* Created by Karel Maesen, Geovise BVBA on 01/11/16.
|
||||
*/
|
||||
public class PostgisPG82Dialect extends PostgreSQL82Dialect implements SpatialDialect {
|
||||
|
||||
|
||||
private PostgisSupport support = new PostgisSupport();
|
||||
transient private PostgisSupport support = new PostgisSupport();
|
||||
|
||||
/**
|
||||
* Creates an instance
|
||||
|
@ -34,7 +34,7 @@ public class PostgisPG82Dialect extends PostgreSQL82Dialect implements SpatialDi
|
|||
PGGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : support.functionsToRegister() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : support.functionsToRegister() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,21 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.PostgreSQL91Dialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
||||
/**
|
||||
* Extends the {@code PostgreSQL91Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
*
|
||||
* <p>
|
||||
* Created by Karel Maesen, Geovise BVBA on 01/11/16.
|
||||
*/
|
||||
public class PostgisPG91Dialect extends PostgreSQL91Dialect implements SpatialDialect {
|
||||
|
||||
|
||||
private PostgisSupport support = new PostgisSupport();
|
||||
transient private PostgisSupport support = new PostgisSupport();
|
||||
|
||||
/**
|
||||
* Creates an instance
|
||||
*/
|
||||
|
@ -33,7 +34,7 @@ public class PostgisPG91Dialect extends PostgreSQL91Dialect implements SpatialDi
|
|||
PGGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : support.functionsToRegister() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : support.functionsToRegister() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,21 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.PostgreSQL92Dialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
||||
/**
|
||||
* Extends the {@code PostgreSQL92Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
*
|
||||
* Extends the {@code PostgreSQL92Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
* <p>
|
||||
* Created by Karel Maesen, Geovise BVBA on 01/11/16.
|
||||
*/
|
||||
public class PostgisPG92Dialect extends PostgreSQL92Dialect implements SpatialDialect {
|
||||
|
||||
|
||||
private PostgisSupport support = new PostgisSupport();
|
||||
transient private PostgisSupport support = new PostgisSupport();
|
||||
|
||||
/**
|
||||
* Creates an instance
|
||||
*/
|
||||
|
@ -33,7 +34,7 @@ public class PostgisPG92Dialect extends PostgreSQL92Dialect implements SpatialDi
|
|||
PGGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : support.functionsToRegister() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : support.functionsToRegister() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,21 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.PostgreSQL93Dialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
||||
/**
|
||||
* Extends the {@code PostgreSQL93Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
*
|
||||
* Extends the {@code PostgreSQL93Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
* <p>
|
||||
* Created by Karel Maesen, Geovise BVBA on 01/11/16.
|
||||
*/
|
||||
public class PostgisPG93Dialect extends PostgreSQL93Dialect implements SpatialDialect {
|
||||
|
||||
|
||||
private PostgisSupport support = new PostgisSupport();
|
||||
transient private PostgisSupport support = new PostgisSupport();
|
||||
|
||||
/**
|
||||
* Creates an instance
|
||||
*/
|
||||
|
@ -33,7 +34,7 @@ public class PostgisPG93Dialect extends PostgreSQL93Dialect implements SpatialDi
|
|||
PGGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : support.functionsToRegister() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : support.functionsToRegister() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,21 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.PostgreSQL94Dialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
||||
/**
|
||||
* Extends the {@code PostgreSQL94Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
*
|
||||
* Extends the {@code PostgreSQL94Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
* <p>
|
||||
* Created by Karel Maesen, Geovise BVBA on 01/11/16.
|
||||
*/
|
||||
public class PostgisPG94Dialect extends PostgreSQL94Dialect implements SpatialDialect {
|
||||
|
||||
|
||||
private PostgisSupport support = new PostgisSupport();
|
||||
transient private PostgisSupport support = new PostgisSupport();
|
||||
|
||||
/**
|
||||
* Creates an instance
|
||||
*/
|
||||
|
@ -33,7 +34,7 @@ public class PostgisPG94Dialect extends PostgreSQL94Dialect implements SpatialDi
|
|||
PGGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : support.functionsToRegister() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : support.functionsToRegister() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,19 +10,20 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.PostgreSQL95Dialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
||||
/**
|
||||
* Extends the {@code PostgreSQL95Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
* Extends the {@code PostgreSQL95Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
* Created by Karel Maesen, Geovise BVBA on 01/11/16.
|
||||
*/
|
||||
public class PostgisPG95Dialect extends PostgreSQL95Dialect implements SpatialDialect {
|
||||
|
||||
|
||||
private PostgisSupport support = new PostgisSupport();
|
||||
transient private PostgisSupport support = new PostgisSupport();
|
||||
|
||||
/**
|
||||
* Creates an instance
|
||||
*/
|
||||
|
@ -32,7 +33,7 @@ public class PostgisPG95Dialect extends PostgreSQL95Dialect implements SpatialDi
|
|||
PGGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : support.functionsToRegister() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : support.functionsToRegister() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,21 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.PostgreSQL9Dialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
||||
/**
|
||||
** Extends the {@code PostgreSQL9Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
*
|
||||
* * Extends the {@code PostgreSQL9Dialect} to add support for the Postgis spatial types, functions and operators .
|
||||
* <p>
|
||||
* Created by Karel Maesen, Geovise BVBA on 01/11/16.
|
||||
*/
|
||||
public class PostgisPG9Dialect extends PostgreSQL9Dialect implements SpatialDialect {
|
||||
|
||||
|
||||
private PostgisSupport support = new PostgisSupport();
|
||||
transient private PostgisSupport support = new PostgisSupport();
|
||||
|
||||
/**
|
||||
* Creates an instance
|
||||
*/
|
||||
|
@ -33,7 +34,7 @@ public class PostgisPG9Dialect extends PostgreSQL9Dialect implements SpatialDial
|
|||
PGGeometryTypeDescriptor.INSTANCE.getSqlType(),
|
||||
"GEOMETRY"
|
||||
);
|
||||
for ( Map.Entry<String, StandardSQLFunction> entry : support.functionsToRegister() ) {
|
||||
for ( Map.Entry<String, SQLFunction> entry : support.functionsToRegister() ) {
|
||||
registerFunction( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
*/
|
||||
package org.hibernate.spatial.dialect.postgis;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
|
@ -18,7 +20,7 @@ import org.hibernate.spatial.SpatialRelation;
|
|||
/**
|
||||
* Created by Karel Maesen, Geovise BVBA on 29/10/16.
|
||||
*/
|
||||
public class PostgisSupport implements SpatialDialect {
|
||||
public class PostgisSupport implements SpatialDialect, Serializable {
|
||||
|
||||
|
||||
private PostgisFunctions postgisFunctions = new PostgisFunctions();
|
||||
|
|
Loading…
Reference in New Issue