[postgis-users] Using Java/Hibernate with PostGIS
Brian Topping
topping at codehaus.org
Mon May 29 13:01:17 PDT 2006
Greetings,
I'm just getting started with PostGIS, have everything working on
Fedora FC4. I'm really excited to play with it and am very
appreciative of all the work everyone has put in on the project, thanks!
Moving forward, I need to integrate it with a Java environment that
is using the Hibernate object-relational mapper. These two don't
seem to work together out of the box, so I was interested to see if
other folks on the list have pieced together solutions for it or
whether there is a formal solution that I am completely overlooking.
It seems that there are three general ways to solve this problem.
The first is to ignore the work that has been put into the
postgis.jar and do serialization from/to objects with WKT. Another
is by registering Hibernate UserTypes for each of the different
Geometry instantiations that are needed, or finally by using a
Hibernate Dialect, which provides a general packaging for everything
to do with the database.
Some have noted that using indexes with Hibernate seems to be one of
the challenging areas. Since indexes seem to be the only reason not
to simply store WKT in a varchar without PostGIS extensions, this is
a significant question. I'm not sure why this is an issue though,
since the database ResultSet simply has the rows that Hibernate needs
to deserialize and Hibernate processes it from there.
If anyone has invested any effort toward this, any knowledge or code
you could share would be very much appreciated. It would be great if
we could get it rolled up into a Dialect to contribute to the
Hibernate project, so it could be maintained there.
Thanks kindly,
Brian Topping
topping at codehaus.org
More information about the postgis-users
mailing list