Skip to content

Instantly share code, notes, and snippets.

@geobabbler
Last active August 13, 2021 04:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geobabbler/bdc405c5d25ba2b45d81 to your computer and use it in GitHub Desktop.
Save geobabbler/bdc405c5d25ba2b45d81 to your computer and use it in GitHub Desktop.
Simple extension to PostGIS dialect for Hibernate
package com.geomusings.dialect;
//import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.type.CustomType;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
import org.hibernate.spatial.dialect.postgis.PostgisDialect;
import org.hibernate.usertype.UserType;
import org.hibernate.spatial.SpatialAggregate;
import org.hibernate.spatial.SpatialDialect;
import org.hibernate.spatial.SpatialFunction;
import org.hibernate.spatial.SpatialRelation;
/**
*
* @author dollinsw
*/
public class PostgisDialectExtensions extends PostgisDialect {
public PostgisDialectExtensions(){
super();
registerFunction("asgeojson", new StandardSQLFunction("st_asgeojson",
StandardBasicTypes.STRING));
registerFunction("asgml", new StandardSQLFunction("st_asgml",
StandardBasicTypes.STRING));
registerFunction("askml", new StandardSQLFunction("st_askml",
StandardBasicTypes.STRING));
registerFunction("srid", new StandardSQLFunction("st_srid",
StandardBasicTypes.INTEGER));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment