Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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