R: [postgis-users] Spatial Object Queries - complete

Antonio Pace antonio.pace at gmail.com
Wed Jan 31 12:31:47 PST 2007


Hi Norman your work is very interesting, I have two questions:

The first.


>Query union = entityManager.createQuery("Select spatial.Union(p.location,
person.location) from >PersonEntity p, PersonEntity as person where person =
:person"); union.setParameter("person", p);

>The result is a person object (with a location geometry field).

The result is  a person which own geometry field is the Union of p.location
and person.location or the result is a geometry (user defined type)  that
rapresent the union?

In PostGISDialect.java :

registerFunction( PostGISDialect.NAMESPACE + "union", new
StandardSQLFunction("geomunion", Hibernate.custom(GeometryType.class)));


The second (in ejb3 enviroment).

It is possible to use a parameter of type "GeometryType"  in these function?

Example:


Query distance = entityManager.createQuery("Select
spatial.Distance(p.location, :point) from PersonEntity p, where person =
:person");

distance.setParameter("person", thePerson);

org.hibernate.ejb.QueryImpl hs = (QueryImpl) query;

org.hibernate.Query hbQuery = hs.getHibernateQuery();
         
hbQuery.setParameter("point ", thePoint,
org.hibernate.Hibernate.custom(com.mygeometrytypes.GeometryUserType.class));

         
return hbQuery.list();


This is right?


Many thanks,

A.

-----Messaggio originale-----
Da: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] Per conto di Norman
Barker
Inviato: mercoledì 31 gennaio 2007 18.46
A: PostGIS Users Discussion
Oggetto: [postgis-users] Spatial Object Queries - complete

Hi,

After much time (and in the end a stupid mistake on my part of not
recognizing namespaces) I have added the code to do spatial object queries
(HibernateQL (HQL) and EJB(3)-QL) with PostGIS.
hi norman your work is very interesting, I have two questions:


In the attached there is a service file PostGISService.java which exercises
all the functionality of PostGIS from Java Object Queries.

The advantage here is that when you perform these queries you get complex
objects back containing your data (no parsing of resultsets) and these
queries are polymorphic (so include sub-classes). e.g. 

If you use JBoss EJBs (rather than Spring + Hibernate) you will get an
implicit transaction lock on the entity as well.

Hopefully someone finds it of use since the hibernate dialect is portable,
it could be used for a WFS-T, Catalog etc. specific for PostGIS.

My next step is to make it portable across DBs, and to integrate with SOLR
to give a catalog type interface.

Hopefully you are happy to keep this with PostGIS, and give me commit access
to SVN so that I don't have to attach files!!

Many thanks,

Norman   






More information about the postgis-users mailing list