[postgis-users] Hibernate with PostGIS

Norman Barker nbarker at ittvis.com
Sun Nov 19 02:54:45 PST 2006


thanks, I will add that change to the code, and will write a test that with an EJB3 entity that has to create the columns in PostGIS automatically.  This should be directly analagous to hibernate.  I created my database first, and then mapped the pojos; I can understand that this isn't so desirable.

Sandeep I will try to do this week, and resolve your issues with hibernate. 

Thanks for the fix, it was bad of me not to check whether the geom was null!  David are you from Pinan Software?  You are only a couple of miles down the road from me in the UK!  


-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net on behalf of Dave Potts
Sent: Sat 11/18/2006 5:07 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Hibernate with PostGIS
First of all thank you Norman for writing the orginal code.

There is a slight problem with it, it does not handle a null geometry 
column, rewritting nullSafeGet as follows, fixes the problem.

I can not say if it will address Sandeep problems, but it is worth trying.


         * @see 
java.lang.String[], java.lang.Object)
        public Object nullSafeGet(ResultSet resultSet,
                      String[] names, Object owner) throws 
HibernateException, SQLException {
            Geometry result = null;
            String geom = resultSet.getString(names[0]);
            if(geom != null ) {
                BinaryParser parser = new BinaryParser();
                result = parser.parse(geom);
            return result;

Sandeep Kumar Jakkaraju wrote:
> I think Hibernate cannot create that Geometry column automatically !!!
> is it something to do with hbm2ddl.auto !!
> I am able to ..get the geometry from a table with geometry column 
> already created ...
> Norman -->> Would you like me to create a simple tutorial on how to 
> use Hibernate with Postgis ..your tutorial .. is not easy to 
> understand ...
> Thanks
> Sandeep
> ------------------------------------------------------------------------
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

postgis-users mailing list
postgis-users at postgis.refractions.net

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

More information about the postgis-users mailing list