Hibernate spatial & Grails

2 messages Options
Embed this post
Permalink
Andreas Müller-10

Hibernate spatial & Grails

Reply Threaded More More options
Print post
Permalink
Hi,

I'm looking for a simple description of how to integrate HibernateSpatial into grails.

It seems that some people have succeeded in doing so, it would be great to have a little howto - maybe based on the HibernateSpatial tutorial?
I tried to do this but it didn't work. Here's what I did:

- put the HibernateSpatial-related libs into the lib-directory of my grails-app
- created a domain class "Event" with the following source code:
------
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Geometry;

import com.vividsolutions.jts.geom.Point;

class Event {
String title
Point location
Date date
String gemkz
static constraints = {
the_geom(blank:true)
}
}
-------

- created a hibernate mapping file in conf/hibernate
-------
<hibernate-mapping>
<class name="Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="native"/>
</id>
<property name="date" type="timestamp" 
column="EVENT_DATE"/>
<property name="title"/>
<property name="location" 
type="org.hibernatespatial.GeometryUserType" 
column="LOC"/>
</class>
</hibernate-mapping>
-------
- created a config file  in conf/hibernate
------
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.postgresql.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/grailstest</property>
<property name="connection.username">postgres</property>
<property name="connection.password"></property>
<property name="connection.pool_size">1</property>
<property name="dialect">org.hibernatespatial.postgis.PostgisDialect</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping resource="Event.hbm.xml"/>
</session-factory>
</hibernate-configuration>
------

If I start the application I get
Error executing script RunApp: javax.xml.parsers.SAXParser.getXMLReader()Lorg/xml/sax/XMLReader;
java.lang.NoSuchMethodError: javax.xml.parsers.SAXParser.getXMLReader()Lorg/xml/sax/XMLReader;
at groovy.util.XmlSlurper.<init>(XmlSlurper.java:72)


my environment:
Mac OS X 10.5.5
PostgreSQL 8.2.3
Grails 1.0.3

Any help appreciated

Andreas






_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
kungfoo

Re: Hibernate spatial & Grails

Reply Threaded More More options
Print post
Permalink
Hi Andreas

You might want to look at my tutorial, which I recently posted on my new blog, since I could not find info on this anywhere.

http://mollusca.ch/blog/index.php/2008/10/06/grails-spatial-data-postgis