PostGIS - hibernate - EJB3

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

PostGIS - hibernate - EJB3

by Norman Barker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am trying to use EJB3 in Java JBoss (which is hibernate behind the
scenes),

I have marked up a property as follows

        @Column(name="extents")
        public Geometry getExtents()
        {
                return extents;
        }

And my data source looks like

<datasources>
  <local-tx-datasource>
    <jndi-name>GeoDataDS</jndi-name>
 
<connection-url>jdbc:postgresql://127.0.0.1:5432/geometa</connection-url
>
    <driver-class>org.postgis.DriverWrapper</driver-class>
    <user-name>xxx</user-name>
    <password>xxx</password>
      <metadata>
         <type-mapping>PostgreSQL 8.1</type-mapping>
      </metadata>
  </local-tx-datasource>
</datasources>

Where extents is of type org.postgis.Geometry, when I tell the
entityManager to commit this I get invalid geometry error even when I
commit an empty polygon, or  simple linestring such as

LineString ls = new LineString("LINESTRING(191232 243118,191108
243242)");

If anyone has done this with EJB3 I would be really grateful for some
advice, but if you have done it with hibernate I would also be
interested as they are pretty similar.

Many thanks,

Norman
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: PostGIS - hibernate - EJB3

by Norman Barker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have searched all over the place for this, and no one has posted a solution , just the same question !! - apologies if you have already solved this, hope it helps someone.

This allows you to use spatial types from within the EJB3 Java Persistence Architecture.

The solution is as follows (only tested in write mode so far);

EJB3 annotation (the @Type hibernate annotation is key here)

        @Type(type = "org.osgeo.geodata.hibernate.GeometryType")
        @Column(name="extents")
        public Geometry getExtents()
        {
                return extents;
        }

and then GeometryType looks like this

package org.osgeo.geodata.hibernate;

import java.io.Serializable;
import java.sql.Blob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;

import org.hibernate.HibernateException;
import org.hibernate.usertype.UserType;
import org.postgis.Geometry;
import org.postgis.binary.BinaryParser;
import org.postgis.binary.BinaryWriter;

/**
 * @author nbarker $date 16/8/06
 */
public class GeometryType implements UserType {
         private static final int[] SQL_TYPES = { Types.BLOB };
       

        /**
         * @see org.hibernate.usertype.UserType#deepCopy(java.lang.Object)
         */
        public Object deepCopy(Object value) throws HibernateException {
                return value;
        }

        /**
         * @see org.hibernate.usertype.UserType#equals(java.lang.Object, java.lang.Object)
         */
        public boolean equals(Object x, Object y) throws HibernateException {
                if (x == y) {
                        return true;
                } else if (x == null || y == null) {
                        return false;
                } else {
                        return x.equals(y);
                }
        }

        /**
         * @see org.hibernate.usertype.UserType#hashCode(java.lang.Object)
         */
        public int hashCode(Object arg0) throws HibernateException {
                // TODO Auto-generated method stub
                return 0;
        }

        /**
         * @see org.hibernate.usertype.UserType#isMutable()
         */
        public boolean isMutable() {
                return false;
        }

        /**)
         * @see org.hibernate.usertype.UserType#nullSafeGet(java.sql.ResultSet, java.lang.String[], java.lang.Object)
         */
        public Object nullSafeGet(ResultSet resultSet,
                      String[] names, Object owner) throws HibernateException, SQLException {
            Geometry result = null;
            Blob geomAsBlob = resultSet.getBlob(names[0]);
            if (!resultSet.wasNull()) {
              BinaryParser bp = new BinaryParser();
              result = geomAsBlob == null
                ? null
                : bp.parse(geomAsBlob.getBytes(1, (int)geomAsBlob.length()));
            }
            return result;
        }

        /**
         * @see org.hibernate.usertype.UserType#nullSafeSet(java.sql.PreparedStatement, java.lang.Object, int)
         */
        public void nullSafeSet(PreparedStatement statement,
                      Object value, int index) throws HibernateException, SQLException {
            if (value == null) {
                statement.setBytes(index, null);
              } else {
            BinaryWriter bw = new BinaryWriter();
           
            byte[] bytes = bw.writeBinary((Geometry)value);
                statement.setBytes(index, bytes);
              }
        }

        /* (non-Javadoc)
         * @see org.hibernate.usertype.UserType#replace(java.lang.Object, java.lang.Object, java.lang.Object)
         */
        public Object replace(Object arg0, Object arg1, Object arg2) throws HibernateException {
                // TODO Auto-generated method stub
                return null;
        }

        /* (non-Javadoc)
         * @see org.hibernate.usertype.UserType#returnedClass()
         */
        public Class returnedClass() {
                return Geometry.class;
        }

        /**
         * @see org.hibernate.usertype.UserType#sqlTypes()
         */
        public int[] sqlTypes() {
                return GeometryType.SQL_TYPES;
        }

        /**
         * @see org.hibernate.usertype.UserType#assemble(java.io.Serializable, java.lang.Object)
         */
        public Object assemble(Serializable cached, Object owner) throws HibernateException {
                return cached;
        }
       
        /**
         * @see org.hibernate.usertype.UserType#disassemble(java.lang.Object)
         */
        public Serializable disassemble(Object value) throws HibernateException {
                return (Serializable)value;
        }

}




-----Original Message-----
From: postgis-users-bounces@... on behalf of Norman Barker
Sent: Mon 8/7/2006 4:08 PM
To: PostGIS Users Discussion
Subject: [postgis-users] PostGIS - hibernate - EJB3
 
Hi,

I am trying to use EJB3 in Java JBoss (which is hibernate behind the
scenes),

I have marked up a property as follows

        @Column(name="extents")
        public Geometry getExtents()
        {
                return extents;
        }

And my data source looks like

<datasources>
  <local-tx-datasource>
    <jndi-name>GeoDataDS</jndi-name>
 
<connection-url>jdbc:postgresql://127.0.0.1:5432/geometa</connection-url
>
    <driver-class>org.postgis.DriverWrapper</driver-class>
    <user-name>xxx</user-name>
    <password>xxx</password>
      <metadata>
         <type-mapping>PostgreSQL 8.1</type-mapping>
      </metadata>
  </local-tx-datasource>
</datasources>

Where extents is of type org.postgis.Geometry, when I tell the
entityManager to commit this I get invalid geometry error even when I
commit an empty polygon, or  simple linestring such as

LineString ls = new LineString("LINESTRING(191232 243118,191108
243242)");

If anyone has done this with EJB3 I would be really grateful for some
advice, but if you have done it with hibernate I would also be
interested as they are pretty similar.

Many thanks,

Norman
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users




_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

winmail.dat (6K) Download Attachment

Re: PostGIS - hibernate - EJB3

by Markus Schaber-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Norman,

Norman Barker wrote:

> I have searched all over the place for this, and no one has posted a
> solution , just the same question !! - apologies if you have already
> solved this, hope it helps someone.
>
> This allows you to use spatial types from within the EJB3 Java
> Persistence Architecture.
>
> The solution is as follows (only tested in write mode so far);

Looks interesting.

Would you like to contribute it under [L]GPL, so we can include it into
the PostGIS sources?

Thanks,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Parent Message unknown RE: PostGIS - hibernate - EJB3

by Norman Barker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Markus,

I am doing this as part of the OSGEO Geodata project - but I agree its
home is in postgis for this part, I wanted to give it as free a license
as possible - does MIT or BSD sound fine to you, or even Apache - I
personally have no problems with LGPL (JBoss has this license), but
other companies do.

I will package it all up with docs and an ejb deployer and sent it to
you in the near future (within 2 weeks).

Norman

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of
Markus Schaber
Sent: Thursday, August 17, 2006 2:49 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] PostGIS - hibernate - EJB3

Hi, Norman,

Norman Barker wrote:

> I have searched all over the place for this, and no one has posted a
> solution , just the same question !! - apologies if you have already
> solved this, hope it helps someone.
>
> This allows you to use spatial types from within the EJB3 Java
> Persistence Architecture.
>
> The solution is as follows (only tested in write mode so far);

Looks interesting.

Would you like to contribute it under [L]GPL, so we can include it into
the PostGIS sources?

Thanks,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: PostGIS - hibernate - EJB3

by Markus Schaber-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Norman,

Norman Barker wrote:

> I am doing this as part of the OSGEO Geodata project - but I agree its
> home is in postgis for this part, I wanted to give it as free a license
> as possible - does MIT or BSD sound fine to you, or even Apache - I
> personally have no problems with LGPL (JBoss has this license), but
> other companies do.

At least the so-called "revised" BSD License should be fine (the same
PostgreSQL uses), but the old BSD License and the Apache License are
currently not compatible with the GPL.

Note also that someone who has problems with LGPL will not be able to
use the org.postgis.* classes you wrap, as those are LGPL, and are
unlikely to change to a more liberal license. (The rest of PostGIS is GPL.)

> I will package it all up with docs and an ejb deployer and sent it to
> you in the near future (within 2 weeks).

Thanks a lot!
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: PostGIS - hibernate - EJB3

by croisfert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,  I am trying to use custom UserType, but it work fine in a pure Hibernate implementation , but not in JBOSS EJB3, the generated geometry column in postgres is of type "oid" instead of "geometry"    You have any suggestion, i am using jboss-EJB-3.0_RC8-FD and postgis 1.1.3 (on postgres 8.1.4)    

thanks.

Parent Message unknown RE: RE: PostGIS - hibernate - EJB3

by Norman Barker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of
croisfert
Sent: Monday, August 21, 2006 2:54 AM
To: postgis-users@...
Subject: [postgis-users] RE: PostGIS - hibernate - EJB3


hi,  I am trying to use custom UserType, but it work fine in a pure
Hibernate
implementation , but not in JBOSS EJB3, the generated geometry column in
postgres is of type "oid" instead of "geometry"    You have any
suggestion,
i am using jboss-EJB-3.0_RC8-FD and postgis 1.1.3 (on postgres 8.1.4)


thanks.
--


Make sure that the usertype is available on your classpath, I have only
tested it with the Geometry Column type (as the name implies!!), I also
set up postgis as a datasource within JBoss - postgis-ds.xml, and
configured the persistence.xml.  I am writing up a doc for this shortly;
just don't have too much time this week.

Norman
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: RE: PostGIS - hibernate - EJB3

by coster :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,
I have the same problem with JBoss and EJB3.
The column is type "oid" instead of "geometry".

I would be very grateful for a solution - here are my postgis-ds.xml and my persistence.xml:

<datasources>
  <local-tx-datasource>
    <jndi-name>PostgisDS</jndi-name>
    <connection-url>jdbc:postgresql://xxx:5432/tourguide</connection-url>
    <driver-class>org.postgis.DriverWrapper</driver-class>
    <user-name>xxx</user-name>
    <password>xxx</password>
    <new-connection-sql>select 1</new-connection-sql>
    <check-valid-connection-sql>select 1</check-valid-connection-sql>  
    <metadata>
       <type-mapping>PostgreSQL 8.1</type-mapping>
    </metadata>
  </local-tx-datasource>
</datasources>

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="tourguide">
        <jta-data-source>java:/PostgisDS</jta-data-source>      
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="true"/>            
         </properties>        
    </persistence-unit>
</persistence>

Thanks!
Christian.

Norman Barker-3 wrote:

-----Original Message-----
From: postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] On Behalf Of
croisfert
Sent: Monday, August 21, 2006 2:54 AM
To: postgis-users@postgis.refractions.net
Subject: [postgis-users] RE: PostGIS - hibernate - EJB3


hi,  I am trying to use custom UserType, but it work fine in a pure
Hibernate
implementation , but not in JBOSS EJB3, the generated geometry column in
postgres is of type "oid" instead of "geometry"    You have any
suggestion,
i am using jboss-EJB-3.0_RC8-FD and postgis 1.1.3 (on postgres 8.1.4)


thanks.
--


Make sure that the usertype is available on your classpath, I have only
tested it with the Geometry Column type (as the name implies!!), I also
set up postgis as a datasource within JBoss - postgis-ds.xml, and
configured the persistence.xml.  I am writing up a doc for this shortly;
just don't have too much time this week.

Norman
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: RE: RE: PostGIS - hibernate - EJB3

by Norman Barker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

RE: [postgis-users] RE: RE: PostGIS - hibernate - EJB3

Hi,

I have been a bit busy, but it is my intention to write a simple 'spatial' tutorial on EJB3 using the postgis geometry type, the functionality will be simple but should get you started.  I know I said I would have it done by last w/end so I will put it top on my priority list.

Apologies for the delay, posting code with no instructions is bad!

Norman


-----Original Message-----
From: postgis-users-bounces@... on behalf of coster
Sent: Tue 9/5/2006 6:49 AM
To: postgis-users@...
Subject: [postgis-users] RE: RE: PostGIS - hibernate - EJB3


hi,
I have the same problem with JBoss and EJB3.
The column is type "oid" instead of "geometry".

I would be very grateful for a solution - here are my postgis-ds.xml and my
persistence.xml:

<datasources>
  <local-tx-datasource>
    <jndi-name>PostgisDS</jndi-name>
    <connection-url>jdbc:postgresql://xxx:5432/tourguide</connection-url>
    <driver-class>org.postgis.DriverWrapper</driver-class>
    <user-name>xxx</user-name>
    <password>xxx</password>
    <new-connection-sql>select 1</new-connection-sql>
    <check-valid-connection-sql>select 1</check-valid-connection-sql> 
    <metadata>
       <type-mapping>PostgreSQL 8.1</type-mapping>
    </metadata>
  </local-tx-datasource>
</datasources>

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="tourguide">
        <jta-data-source>java:/PostgisDS</jta-data-source>                     
        <properties>
            <property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="true"/>           
         </properties>       
    </persistence-unit>
</persistence>

Thanks!
Christian.


Norman Barker-3 wrote:
>
>
>
> -----Original Message-----
> From: postgis-users-bounces@...
> [postgis-users-bounces@...] On Behalf Of
> croisfert
> Sent: Monday, August 21, 2006 2:54 AM
> To: postgis-users@...
> Subject: [postgis-users] RE: PostGIS - hibernate - EJB3
>
>
> hi,  I am trying to use custom UserType, but it work fine in a pure
> Hibernate
> implementation , but not in JBOSS EJB3, the generated geometry column in
> postgres is of type "oid" instead of "geometry"    You have any
> suggestion,
> i am using jboss-EJB-3.0_RC8-FD and postgis 1.1.3 (on postgres 8.1.4)
>
>
> thanks.
> --
>
>
> Make sure that the usertype is available on your classpath, I have only
> tested it with the Geometry Column type (as the name implies!!), I also
> set up postgis as a datasource within JBoss - postgis-ds.xml, and
> configured the persistence.xml.  I am writing up a doc for this shortly;
> just don't have too much time this week.
>
> Norman
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>

--
View this message in context: http://www.nabble.com/PostGIS---hibernate---EJB3-tf2064211.html#a6146402
Sent from the PostGIS - User forum at Nabble.com.

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: RE: RE: PostGIS - hibernate - EJB3

by coster :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Norman,
thank you for your tutorial!

Storing data in a geometry column works fine if I create a new object and persist it with the entity manager.
But if I try to edit the data with 'merge' from the database manager its not working:

PersonEntity pe = entityManager.find(PersonEntity.class, new Long(1).longValue());
pe.setLocation(new Point(8,5));
entityManager.merge(pe);

How can I fix this problem?

And their is a NullPointerException if I try to read a list of data from the database:
        public Object nullSafeGet(ResultSet resultSet,
                      String[] names, Object owner) throws HibernateException, SQLException {
            Geometry result = null;
            String geom = resultSet.getString(names[0]);
            try{
                    BinaryParser parser = new BinaryParser();
                    result = parser.parse(geom);
            }
            catch(NullPointerException e){
            logger.error("nullSafeGet() geom result"+geom);
            }
            return result;
        }

Tank you for your help,
Christian.

Norman Barker-3 wrote:
Hi,

I have been a bit busy, but it is my intention to write a simple 'spatial' tutorial on EJB3 using the postgis geometry type, the functionality will be simple but should get you started.  I know I said I would have it done by last w/end so I will put it top on my priority list.

Apologies for the delay, posting code with no instructions is bad!

Norman


-----Original Message-----
From: postgis-users-bounces@postgis.refractions.net on behalf of coster
Sent: Tue 9/5/2006 6:49 AM
To: postgis-users@postgis.refractions.net
Subject: [postgis-users] RE: RE: PostGIS - hibernate - EJB3
 

hi,
I have the same problem with JBoss and EJB3.
The column is type "oid" instead of "geometry".

I would be very grateful for a solution - here are my postgis-ds.xml and my
persistence.xml:

<datasources>
  <local-tx-datasource>
    <jndi-name>PostgisDS</jndi-name>
    <connection-url>jdbc:postgresql://xxx:5432/tourguide</connection-url>
    <driver-class>org.postgis.DriverWrapper</driver-class>
    <user-name>xxx</user-name>
    <password>xxx</password>
    <new-connection-sql>select 1</new-connection-sql>
    <check-valid-connection-sql>select 1</check-valid-connection-sql>  
    <metadata>
       <type-mapping>PostgreSQL 8.1</type-mapping>
    </metadata>
  </local-tx-datasource>
</datasources>

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="tourguide">
        <jta-data-source>java:/PostgisDS</jta-data-source>      
        <properties>
            <property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="true"/>            
         </properties>        
    </persistence-unit>
</persistence>

Thanks!
Christian.


Norman Barker-3 wrote:
>
>
>
> -----Original Message-----
> From: postgis-users-bounces@postgis.refractions.net
> [mailto:postgis-users-bounces@postgis.refractions.net] On Behalf Of
> croisfert
> Sent: Monday, August 21, 2006 2:54 AM
> To: postgis-users@postgis.refractions.net
> Subject: [postgis-users] RE: PostGIS - hibernate - EJB3
>
>
> hi,  I am trying to use custom UserType, but it work fine in a pure
> Hibernate
> implementation , but not in JBOSS EJB3, the generated geometry column in
> postgres is of type "oid" instead of "geometry"    You have any
> suggestion,
> i am using jboss-EJB-3.0_RC8-FD and postgis 1.1.3 (on postgres 8.1.4)
>
>
> thanks.
> --
>
>
> Make sure that the usertype is available on your classpath, I have only
> tested it with the Geometry Column type (as the name implies!!), I also
> set up postgis as a datasource within JBoss - postgis-ds.xml, and
> configured the persistence.xml.  I am writing up a doc for this shortly;
> just don't have too much time this week.
>
> Norman
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>

--
View this message in context: http://www.nabble.com/PostGIS---hibernate---EJB3-tf2064211.html#a6146402
Sent from the PostGIS - User forum at Nabble.com.

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Parent Message unknown RE: RE: RE: RE: PostGIS - hibernate - EJB3

by Norman Barker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Christian,

Thanks for trying out the tutorial and giving me my first bug report!  I
have fixed this error - my apologies although I know JBoss; I don't know
hibernate so well.

I have asked for commit access to postgis this morning but for now if
you replace the the 'replace' method in
org.postgis.hibernate.GeometryType as follows;

        public Object replace(Object original, Object target, Object
owner) throws HibernateException {
                return original;
        }

Then the merge operation will work.

The other bug where you return a list is a result of the location column
being corrupted (it is null) from the use of bug #1, resetting this data
and everything should work - if not let me know.

I welcome more comments on the tutorial and EJB3.  I am currently
figuring out how to server testing with EJB3 - there is talk of being
able to do it with embeddable JBoss - ideas welcomed.

Thanks,

Norman

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of
coster
Sent: 06 October 2006 10:53
To: postgis-users@...
Subject: [postgis-users] RE: RE: RE: PostGIS - hibernate - EJB3


Hi Norman,
thank you for your tutorial!

Storing data in a geometry column works fine if I create a new object
and
persist it with the entity manager.
But if I try to edit the data with 'merge' from the database manager its
not
working:

PersonEntity pe = entityManager.find(PersonEntity.class, new
Long(1).longValue());
pe.setLocation(new Point(8,5));
entityManager.merge(pe);

How can I fix this problem?

And their is a NullPointerException if I try to read a list of data from
the
database:
        public Object nullSafeGet(ResultSet resultSet,
                      String[] names, Object owner) throws
HibernateException,
SQLException {
            Geometry result = null;
            String geom = resultSet.getString(names[0]);
            try{
                    BinaryParser parser = new BinaryParser();
                    result = parser.parse(geom);
            }
            catch(NullPointerException e){
            logger.error("nullSafeGet() geom result"+geom);
            }
            return result;
        }

Tank you for your help,
Christian.


Norman Barker-3 wrote:
>
> Hi,
>
> I have been a bit busy, but it is my intention to write a simple
'spatial'
> tutorial on EJB3 using the postgis geometry type, the functionality
will
> be simple but should get you started.  I know I said I would have it
done
> by last w/end so I will put it top on my priority list.
>
> Apologies for the delay, posting code with no instructions is bad!
>
> Norman
>
>
> -----Original Message-----
> From: postgis-users-bounces@... on behalf of
coster

> Sent: Tue 9/5/2006 6:49 AM
> To: postgis-users@...
> Subject: [postgis-users] RE: RE: PostGIS - hibernate - EJB3
>  
>
> hi,
> I have the same problem with JBoss and EJB3.
> The column is type "oid" instead of "geometry".
>
> I would be very grateful for a solution - here are my postgis-ds.xml
and
> my
> persistence.xml:
>
> <datasources>
>   <local-tx-datasource>
>     <jndi-name>PostgisDS</jndi-name>
>
<connection-url>jdbc:postgresql://xxx:5432/tourguide</connection-url>
>     <driver-class>org.postgis.DriverWrapper</driver-class>
>     <user-name>xxx</user-name>
>     <password>xxx</password>
>     <new-connection-sql>select 1</new-connection-sql>
>     <check-valid-connection-sql>select 1</check-valid-connection-sql>

>     <metadata>
>        <type-mapping>PostgreSQL 8.1</type-mapping>
>     </metadata>
>   </local-tx-datasource>
> </datasources>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence">
>     <persistence-unit name="tourguide">
>         <jta-data-source>java:/PostgisDS</jta-data-source>

>         <properties>
>             <property name="hibernate.dialect"
> value="org.hibernate.dialect.PostgreSQLDialect"/>
>             <property name="hibernate.hbm2ddl.auto" value="update"/>
>             <property name="hibernate.show_sql" value="true"/>

>          </properties>        
>     </persistence-unit>
> </persistence>
>
> Thanks!
> Christian.
>
>
> Norman Barker-3 wrote:
>>
>>
>>
>> -----Original Message-----
>> From: postgis-users-bounces@...
>> [mailto:postgis-users-bounces@...] On Behalf Of
>> croisfert
>> Sent: Monday, August 21, 2006 2:54 AM
>> To: postgis-users@...
>> Subject: [postgis-users] RE: PostGIS - hibernate - EJB3
>>
>>
>> hi,  I am trying to use custom UserType, but it work fine in a pure
>> Hibernate
>> implementation , but not in JBOSS EJB3, the generated geometry column
in

>> postgres is of type "oid" instead of "geometry"    You have any
>> suggestion,
>> i am using jboss-EJB-3.0_RC8-FD and postgis 1.1.3 (on postgres 8.1.4)
>>
>>
>> thanks.
>> --
>>
>>
>> Make sure that the usertype is available on your classpath, I have
only
>> tested it with the Geometry Column type (as the name implies!!), I
also
>> set up postgis as a datasource within JBoss - postgis-ds.xml, and
>> configured the persistence.xml.  I am writing up a doc for this
shortly;

>> just don't have too much time this week.
>>
>> Norman
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@...
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
> --
> View this message in context:
>
http://www.nabble.com/PostGIS---hibernate---EJB3-tf2064211.html#a6146402

> Sent from the PostGIS - User forum at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>

--
View this message in context:
http://www.nabble.com/PostGIS---hibernate---EJB3-tf2064211.html#a6676142
Sent from the PostGIS - User mailing list archive at Nabble.com.

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: RE: RE: RE: PostGIS - hibernate - EJB3

by Markus Schaber-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Norman,

Norman Barker wrote:

> I have asked for commit access to postgis this morning but for now if
> you replace the the 'replace' method in
> org.postgis.hibernate.GeometryType as follows;
>
> public Object replace(Object original, Object target, Object
> owner) throws HibernateException {
> return original;
> }
>
> Then the merge operation will work.

I just committed this change to the repository.

When I started sending patches to the java code to postgis-devel, strk
felt flooded after some time, and asked Paul to give me commit access.
That's how I became maintainer :-)

Thanks,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: RE: RE: RE: PostGIS - hibernate - EJB3

by coster :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Norman,
thanks for your patch.

Sorry for my late response to your mail (nice weather and wonderful mountains here in austria). I have tested it - it works fine now!

Thanks,
Christian.

Markus Schaber wrote:
Hi, Norman,

Norman Barker wrote:

> I have asked for commit access to postgis this morning but for now if
> you replace the the 'replace' method in
> org.postgis.hibernate.GeometryType as follows;
>
> public Object replace(Object original, Object target, Object
> owner) throws HibernateException {
> return original;
> }
>
> Then the merge operation will work.

I just committed this change to the repository.

When I started sending patches to the java code to postgis-devel, strk
felt flooded after some time, and asked Paul to give me commit access.
That's how I became maintainer :-)

Thanks,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: RE: RE: PostGIS - hibernate - EJB3

by whiteman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Norman (and others),

I have serveral questions/problems:

1. Can you point me where I can find your manual concerning PostGIS and the use of GeometryType ?

2. In the thread here, people are using:
<driver-class>org.postgis.DriverWrapper</driver-class>
When I do the same, I get a "No suitable driver" exception.

For the moment I am using:  <driver-class>org.postgresql.Driver</driver-class> and that seems to work for simple tests.

Is this important ? Maybe this is related with the errors I am getting further the line.

3. I wanted to use the GeometryType that is packed in PostGIS 1.1.5.
After generating the new JAR and replacing the old one by this one,
I start getting new exceptions:
The class org.postgis.PGbox3d does not implement org.postgresql.util.PGobject.

Any Idea what this means ??

4. Now I put the old PostGIS back and make a very small JAR that contains BinaryWriter and GeometryType, and also add it to the classpath. This is what he sais now:
org.hibernate.MappingException: Could not determine type for: org.postgis.hibernate.GeometryType

My object looks like this:

                ........
        @Type(type = "org.postgis.hibernate.GeometryType")
        @Column(name="footprint", columnDefinition="Geometry")
        public Geometry getFootprint() {
                return footprint;
        }
       
        public void setFootprint(Geometry footprint) {
                this.footprint = footprint;
        }
               ....................

And if I add 'import org.postgis.hibernate.GeometryType' to the object, he does not complain he does not know that import, so the GeometryType is well added to the project.

Is there anyone who sees a light through this strange effects ?

thanks in advance,
Jan



Norman Barker-3 wrote:
Hi,

I have been a bit busy, but it is my intention to write a simple 'spatial' tutorial on EJB3 using the postgis geometry type, the functionality will be simple but should get you started.  I know I said I would have it done by last w/end so I will put it top on my priority list.

Apologies for the delay, posting code with no instructions is bad!

Norman

Parent Message unknown RE: RE: RE: RE: PostGIS - hibernate - EJB3

by Norman Barker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of
whiteman
Sent: 07 November 2006 10:40
To: postgis-users@...
Subject: [postgis-users] RE: RE: RE: PostGIS - hibernate - EJB3


Hi Norman (and others),

I have serveral questions/problems:

1. Can you point me where I can find your manual concerning PostGIS and
the
use of GeometryType ?

<ncb>Thanks to Markus this is now in SVN -
http://svn.refractions.net/postgis/trunk/java/ejb3/ in particular
http://svn.refractions.net/postgis/trunk/java/ejb3/ejb3spatial.pdf
</ncb>

2. In the thread here, people are using:
<driver-class>org.postgis.DriverWrapper</driver-class>
When I do the same, I get a "No suitable driver" exception.

For the moment I am using:
<driver-class>org.postgresql.Driver</driver-class> and that seems to
work
for simple tests.

Is this important ? Maybe this is related with the errors I am getting
further the line.

<ncb>You need to use the driverwrapper class or register the geometry
types yourself; the tutorial has more details.  A sample datasource is
here
http://svn.refractions.net/postgis/trunk/java/ejb3/jboss/geodata-ds.xml
</ncb>


3. I wanted to use the GeometryType that is packed in PostGIS 1.1.5.
After generating the new JAR and replacing the old one by this one,
I start getting new exceptions:
The class org.postgis.PGbox3d does not implement
org.postgresql.util.PGobject.

Any Idea what this means ??

<ncb>I don't know on this one, sorry.</ncb>

4. Now I put the old PostGIS back and make a very small JAR that
contains
BinaryWriter and GeometryType, and also add it to the classpath. This is
what he sais now:
org.hibernate.MappingException: Could not determine type for:
org.postgis.hibernate.GeometryType

My object looks like this:

                ........
        @Type(type = "org.postgis.hibernate.GeometryType")
        @Column(name="footprint", columnDefinition="Geometry")
        public Geometry getFootprint() {
                return footprint;
        }
       
        public void setFootprint(Geometry footprint) {
                this.footprint = footprint;
        }
               ....................

And if I add 'import org.postgis.hibernate.GeometryType' to the object,
he
does not complain he does not know that import, so the GeometryType is
well
added to the project.

<ncb>this just means that it can't find the jar file on the classpath
for this type.  Please go through the tutorial and do contact me if you
have any problems - quite happy to go through the steps required to get
this running.

Watch this space for my catalog tutorial before the end of this month on
PostGIS, hibernate and Lucene!

Thanks

</ncb>

Is there anyone who sees a light through this strange effects ?

thanks in advance,
Jan




Norman Barker-3 wrote:
>
> Hi,
>
> I have been a bit busy, but it is my intention to write a simple
'spatial'
> tutorial on EJB3 using the postgis geometry type, the functionality
will
> be simple but should get you started.  I know I said I would have it
done
> by last w/end so I will put it top on my priority list.
>
> Apologies for the delay, posting code with no instructions is bad!
>
> Norman
>
>

--
View this message in context:
http://www.nabble.com/PostGIS---hibernate---EJB3-tf2064211.html#a7216080
Sent from the PostGIS - User mailing list archive at Nabble.com.

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: RE: RE: RE: PostGIS - hibernate - EJB3

by Markus Schaber-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Norman Barker wrote:

> 2. In the thread here, people are using:
> <driver-class>org.postgis.DriverWrapper</driver-class>
> When I do the same, I get a "No suitable driver" exception.

[...]
> 3. I wanted to use the GeometryType that is packed in PostGIS 1.1.5.
> After generating the new JAR and replacing the old one by this one,
> I start getting new exceptions:
> The class org.postgis.PGbox3d does not implement
> org.postgresql.util.PGobject.

Those 2 things look like a classpath/classloader problem.

You have to make sure that the postgis.jar and the postgresql-jdbc.jar
are available via the same classloader (and that you don't have two
incarnations of them in your classpath)


HTH,
Markus


--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: RE: RE: RE: PostGIS - hibernate - EJB3

by whiteman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Markus for responding.
In the meantime I found the same answer you are suggesting elsewhere:
http://postgis.refractions.net/pipermail/postgis-users/2005-March/007153.htm
l

I just pass it, so other might be helped by it too.

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of Markus
Schaber
Sent: samedi 25 novembre 2006 10:16
To: PostGIS Users Discussion
Subject: Re: [postgis-users] RE: RE: RE: PostGIS - hibernate - EJB3

Hi,

Norman Barker wrote:

> 2. In the thread here, people are using:
> <driver-class>org.postgis.DriverWrapper</driver-class>
> When I do the same, I get a "No suitable driver" exception.

[...]
> 3. I wanted to use the GeometryType that is packed in PostGIS 1.1.5.
> After generating the new JAR and replacing the old one by this one, I
> start getting new exceptions:
> The class org.postgis.PGbox3d does not implement
> org.postgresql.util.PGobject.

Those 2 things look like a classpath/classloader problem.

You have to make sure that the postgis.jar and the postgresql-jdbc.jar are
available via the same classloader (and that you don't have two incarnations
of them in your classpath)


HTH,
Markus


--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org _______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: PostGIS - hibernate (new postgis.jar)

by whiteman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Markus,

The thing I did to be able to continue is I have created a postgis_addon.jar
lib that contained only new stuff like BinaryWriter.class and
GeometryUserType.
And that works. It does not solve the problem, though I can use the latest
version of postgis.

I tried to use the tip I found in my previous posting by changing the name
of the postgresql-jdbc.jar drvier to pg-jdbc.jar driver with my new build
postgis2.jar (version 1.1.5)
I did not help.  
If I remove the 2 stub files (PGConnection and Connection) from postgis2.jar
: same result.
It stucks again on "No suitable driver".
If I replace the postgis2.jar by postgis.jar(1.1.0) and postgis_addon.jar by
changing the settings on the classpath, everything works again.

So, I assume there is a thing in postgis2.jar.
And to create my postgis2.jar, I made a separate project in Eclipse, created
a jar file of almost all java files(exl examples). This should do it, no ?

Anyway, I included my postgis2.jar so maybe one can replace his one with
mine and see what that does.
Or maybe one sees what I am doing wrong elsewhere...

TIA,
Jan

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of Markus
Schaber
Sent: samedi 25 novembre 2006 10:16
To: PostGIS Users Discussion
Subject: Re: [postgis-users] RE: RE: RE: PostGIS - hibernate - EJB3

Hi,

Norman Barker wrote:

> 2. In the thread here, people are using:
> <driver-class>org.postgis.DriverWrapper</driver-class>
> When I do the same, I get a "No suitable driver" exception.

[...]
> 3. I wanted to use the GeometryType that is packed in PostGIS 1.1.5.
> After generating the new JAR and replacing the old one by this one, I
> start getting new exceptions:
> The class org.postgis.PGbox3d does not implement
> org.postgresql.util.PGobject.

Those 2 things look like a classpath/classloader problem.

You have to make sure that the postgis.jar and the postgresql-jdbc.jar are
available via the same classloader (and that you don't have two incarnations
of them in your classpath)


HTH,
Markus


--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org _______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users


postgis2.jar (58K) Download Attachment

Parent Message unknown RE: PostGIS - hibernate (new postgis.jar)

by Norman Barker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I think I missed the start of this thread (and I can't find it in the
archives), can you summarize the problem, and the server you are using?


The GeometryUserType class doesn't do very much but call out to the
utility functions provided in the postgis jar, so it does sound like a
classpath issue.

If you can send me a summary I will try to recreate the problem.  (I
have both tomcat and jboss set up here).

If the attachment is large please send it to norman.barker<at>gmail.com

Thanks,

Norman

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of Jan
Syryn
Sent: 27 November 2006 16:39
To: 'PostGIS Users Discussion'
Subject: RE: [postgis-users] PostGIS - hibernate (new postgis.jar)

***********************
Warning: Your file, postgis2.jar, contains more than 32 files after
decompression and cannot be scanned.
***********-***********


Hi Markus,

The thing I did to be able to continue is I have created a
postgis_addon.jar
lib that contained only new stuff like BinaryWriter.class and
GeometryUserType.
And that works. It does not solve the problem, though I can use the
latest
version of postgis.

I tried to use the tip I found in my previous posting by changing the
name
of the postgresql-jdbc.jar drvier to pg-jdbc.jar driver with my new
build
postgis2.jar (version 1.1.5)
I did not help.  
If I remove the 2 stub files (PGConnection and Connection) from
postgis2.jar
: same result.
It stucks again on "No suitable driver".
If I replace the postgis2.jar by postgis.jar(1.1.0) and
postgis_addon.jar by
changing the settings on the classpath, everything works again.

So, I assume there is a thing in postgis2.jar.
And to create my postgis2.jar, I made a separate project in Eclipse,
created
a jar file of almost all java files(exl examples). This should do it, no
?

Anyway, I included my postgis2.jar so maybe one can replace his one with
mine and see what that does.
Or maybe one sees what I am doing wrong elsewhere...

TIA,
Jan

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of
Markus
Schaber
Sent: samedi 25 novembre 2006 10:16
To: PostGIS Users Discussion
Subject: Re: [postgis-users] RE: RE: RE: PostGIS - hibernate - EJB3

Hi,

Norman Barker wrote:

> 2. In the thread here, people are using:
> <driver-class>org.postgis.DriverWrapper</driver-class>
> When I do the same, I get a "No suitable driver" exception.

[...]
> 3. I wanted to use the GeometryType that is packed in PostGIS 1.1.5.
> After generating the new JAR and replacing the old one by this one, I
> start getting new exceptions:
> The class org.postgis.PGbox3d does not implement
> org.postgresql.util.PGobject.

Those 2 things look like a classpath/classloader problem.

You have to make sure that the postgis.jar and the postgresql-jdbc.jar
are
available via the same classloader (and that you don't have two
incarnations
of them in your classpath)


HTH,
Markus


--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

RE: PostGIS - hibernate (new postgis.jar)

by rabbiaqaswar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thankyou all for the support.

I  am using EJB3 with PostgreSQL & JBoss. Read through the tutorial on svn by Norman Barker. I compiled the GeometryType java file in org.postgis.hibernate and included the org.postgis.hibernate package in my classpath and the whole thing worked.

Since the last post on this forum was in November 2006, i wanted to know that is there any change in the method to handle gis data from postgresql tables using ejb3 architecture? Is the GeometryType class by Norman included in the latest release of postgis.jar or should it be included seperately like i mentioned above?

Thanks again

Norman Barker-3 wrote:
I think I missed the start of this thread (and I can't find it in the
archives), can you summarize the problem, and the server you are using?


The GeometryUserType class doesn't do very much but call out to the
utility functions provided in the postgis jar, so it does sound like a
classpath issue.

If you can send me a summary I will try to recreate the problem.  (I
have both tomcat and jboss set up here).

If the attachment is large please send it to norman.barker<at>gmail.com

Thanks,

Norman

-----Original Message-----
From: postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] On Behalf Of Jan
Syryn
Sent: 27 November 2006 16:39
To: 'PostGIS Users Discussion'
Subject: RE: [postgis-users] PostGIS - hibernate (new postgis.jar)

***********************
Warning: Your file, postgis2.jar, contains more than 32 files after
decompression and cannot be scanned.
***********-***********


Hi Markus,

The thing I did to be able to continue is I have created a
postgis_addon.jar
lib that contained only new stuff like BinaryWriter.class and
GeometryUserType.
And that works. It does not solve the problem, though I can use the
latest
version of postgis.

I tried to use the tip I found in my previous posting by changing the
name
of the postgresql-jdbc.jar drvier to pg-jdbc.jar driver with my new
build
postgis2.jar (version 1.1.5)
I did not help.  
If I remove the 2 stub files (PGConnection and Connection) from
postgis2.jar
: same result.
It stucks again on "No suitable driver".
If I replace the postgis2.jar by postgis.jar(1.1.0) and
postgis_addon.jar by
changing the settings on the classpath, everything works again.

So, I assume there is a thing in postgis2.jar.
And to create my postgis2.jar, I made a separate project in Eclipse,
created
a jar file of almost all java files(exl examples). This should do it, no
?

Anyway, I included my postgis2.jar so maybe one can replace his one with
mine and see what that does.
Or maybe one sees what I am doing wrong elsewhere...

TIA,
Jan

-----Original Message-----
From: postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] On Behalf Of
Markus
Schaber
Sent: samedi 25 novembre 2006 10:16
To: PostGIS Users Discussion
Subject: Re: [postgis-users] RE: RE: RE: PostGIS - hibernate - EJB3

Hi,

Norman Barker wrote:

> 2. In the thread here, people are using:
> <driver-class>org.postgis.DriverWrapper</driver-class>
> When I do the same, I get a "No suitable driver" exception.

[...]
> 3. I wanted to use the GeometryType that is packed in PostGIS 1.1.5.
> After generating the new JAR and replacing the old one by this one, I
> start getting new exceptions:
> The class org.postgis.PGbox3d does not implement
> org.postgresql.util.PGobject.

Those 2 things look like a classpath/classloader problem.

You have to make sure that the postgis.jar and the postgresql-jdbc.jar
are
available via the same classloader (and that you don't have two
incarnations
of them in your classpath)


HTH,
Markus


--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
< Prev | 1 - 2 | Next >