[postgis-users] Using Postgis with hibernate

Norman Barker nbarker at ittvis.com
Sun Mar 18 20:54:04 PDT 2007


Hi David,

there is a tutorial available here on using postgis and hibernate

http://postgis.refractions.net/support/wiki/index.php?SpatialEJB3

This defines a hibernate geometry user type that maps a postgis geometry (so anything that subclasses geometry) to and from postgis.

in addition in the subversion source control there is also a hibernate postgis dialect to allow you to make hibernate spatial object queries.

Though the tutorial uses Java 5 annotations, this also works with hibernate property files.

Please let me know if you have any problems.

thanks,

Norman


-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net on behalf of David Robison
Sent: Mon 3/19/2007 3:46 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Using Postgis with hibernate
 
I am running a standalone console application which uses Hibernate3 and connects to a postgis database. I have been successful in reading the geomoetry from the database when I define my geometry column in Hibernate as

    <property
        name="theGeom"
        type="java.lang.String"
        formula="AsText(force_2d(the_geom))"
        length="-1"
    />

This returns the geometry as a WKT string that can easily be read by my application. However, using this definition I am not able to set the value of the geometry. I have read the mailing list about postgis and hibernate and am just more confused. Is there a simple way to define the geometry column to Hibernate to make getting and setting the geometry simple? I would even be pleased with referencing the geometry data as a byte[] or a String from within Java.

Any help and/or clarification would be appreciated.

David Robison

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070319/10577ddd/attachment.html>


More information about the postgis-users mailing list