[ANN] Hibernate Spatial Plugin - Beta

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Hibernate Spatial Plugin - Beta

Daniel Henrique Alves Lima
    Hi.

    For anyone interested, I developed a very basic plugin to integrate
Grails 1.3.7 with hibernate-spatial:
https://github.com/daniel-lima/grails-hibernate-spatial-plugin. So far
the plugin only handles dependency resolution and the configuration of
Hibernate's custom user types and Hibernate's dialect.
    There is a different plugin for each provider supported by
hibernate-spatial (http://www.hibernatespatial.org/). So, if you want to
use hibernate-spatial for PostGIS, you must install
hibernate-spatial-postgresql (and PostGIS !!! :-)).
    Of course it's virtually impossible to have all RDMBS installed,
with spatial extension enabled and properly configured, just to test the
child plugins. Any help in this regard would be appreciated.

    In a quick test using GeoDB/H2
(http://wiki.github.com/jdeolive/geodb/), I have:

    1. Created a database with Spatial support enabled (I think :-));

    2. Declared the appropriated dependency for the JDBC driver

    dependencies {
        runtime 'com.h2database:h2:1.1.118'
    }

    3.  Changed the JDBC URL

            url = "jdbc:h2:file:devDB"

    4. Created a domain class using the JTS Geometry types

import com.vividsolutions.jts.geom.Point

class X {

    static constraints = {
    }

    static mapping = {
          location /* GeoDB bug or limitation? */ sqlType: 'BLOB'
    }

    String name
    Point location
}

    5. Changed BootStrap.groovy for inserting and searching Xs.


    I saw that problems about datatypes are very common in
hibernate-spatial, so it's a good idea to check first on Google if you
start seeing messages about invalid types or invalid geometries :-|
    It's also a good idea to keep Hibernate's debug enabled until you
few comfortable about the spatial extent/extension:

log4j = {
    // (...)
    debug  'org.hibernate.SQL', 'org.hibernatespatial'
    trace 'org.hibernate.type'
}

    Good luck to all.

    Best regards,

          Daniel.
   


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Hibernate Spatial Plugin - Beta

Daniel Henrique Alves Lima
    Hi.

    Additional docs:

    http://www.grails.org/plugin/hibernate-spatial
    http://www.grails.org/plugin/hibernate-spatial-hdb
    http://www.grails.org/plugin/hibernate-spatial-postgresql

    Best regards,

         Daniel.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email