Sign in to edit and +1 items.
Login required
Download

Hibernate Spatial Grails Plugin

(0)
Author(s) Daniel Henrique Alves Lima
Current Release 0.0.4   (7 months ago)
Grails Version 1.2.0 > *
Tags hibernate spatial 
Dependency
compile ":hibernate-spatial:0.0.4"
Last updated by daniel_henrique 7 months ago
One of the following:

grails install-plugin hibernate-spatial-hdb
grails install-plugin hibernate-spatial-mysql
grails install-plugin hibernate-spatial-oracle
grails install-plugin hibernate-spatial-postgresql
grails install-plugin hibernate-spatial-sqlserver

Project at GitHub is grails-hibernate-spatial-plugin

Last updated by daniel_henrique 7 months ago
It provides support for using the Hibernate Spatial in Grails.

How it works

The core plugin is not for direct use. There is a child plugin for each Provider supported by Hibernate Spatial:

The integration is very simple. A child plugin will automatically:
  • Register new Hibernate custom user types in Config.groovy;
/* Added by the Hibernate Spatial Plugin. */
grails.gorm.default.mapping = {
   'user-type'(type:org.hibernatespatial.GeometryUserType, class:com.vividsolutions.jts.geom.Geometry)
   'user-type'(type:org.hibernatespatial.GeometryUserType, class:com.vividsolutions.jts.geom.GeometryCollection)
   // Additional user-type mappings
}
  • Change the Hibernate Dialect and the JDBC Driver class in DataSource(s).groovy;
/* Added by the Hibernate Spatial Plugin. */
dataSource {
   driverClassName = // Suitable JDBC Driver
   dialect = // Suitable Hibernate Spatial Dialect
}
  • Define repositories and resolve library dependencies.
// plugin's BuildConfig.groovy
repositories {
   // (...)

mavenRepo 'http://download.osgeo.org/webdav/geotools' mavenRepo 'http://www.hibernatespatial.org/repository' }

dependencies { // Suitable dependencies for this Provider }

Basic usage

  • Install the appropriate child plugin;
  • Create a spatially enabled database;
  • Configure the corresponding JDBC Driver dependency in BuildConfig.groovy;
  • Change the JDBC URL in DataSource(s).groovy;
  • In your domain classes, define properties of the type com.vividsolutions.jts.geom.Geometry (or subclasses);
  • Perform some tests using save, dynamic finders, HQL and Criteria.
Last updated by admin 7 months ago
Last updated by admin 7 months ago