-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Not all postgis spatial operators work in HQL where clause
PostPosted: Thu Aug 19, 2004 7:15 pm 
Newbie

Joined: Wed Oct 01, 2003 7:15 pm
Posts: 10
I've managed to get HQL working with postgis... thanks to some help from the hibernate forums. Some of the spatial operators are working and some don't work.

This query for a specific geometry with operator "~=" works:

WHERE
GEOM ~= GeometryFromText('POINT(1 1 1)',-1);

This query finding all the geometries inside a box also works:

WHERE
GeometryFromText('BOX3D(1 1 1, 100 100 100)',-1) ~ GEOM;

This query using the overlaps operator "&&" does not work:

WHERE
GEOM && GeometryFromText('BOX3D(1 1 1, 100 100 100)',-1);

Nor does this work:

WHERE
GEOM @ GeometryFromText('BOX3D(1 1 1, 100 100 100)',-1);



Is there any way to quote these operators, "&&" and "@", to get them to pass through the HQL parser?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 2:24 am 
Newbie

Joined: Wed Apr 20, 2005 3:19 am
Posts: 5
Dear rrdodes

From your emails to hibernate formus,I see that you can use PostGIS in Hibernate.
This have been a big problem for me. Can you send me some complete examples (including usertype and PropertyAccessor) or any thing that you think will be usefull?

I look forward to hearing you soon.

MRB
heenco2000@yahoo.com

_________________
MRB


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 5:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can define them as functions in your dialect.

(or simply just use native sql since these will anyhow only be usable on that one db)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 4:57 am 
Newbie

Joined: Tue Jul 04, 2006 12:32 pm
Posts: 4
Hi

I try to use some postgis functions like within, contains, overlaps, crosses in hibernate with HQL.

the actual SQL query looks like this.
List res = session.createSQLQuery("select within(" + pointstring + ", coordinates) from geoobjects;").addScalar("within", Hibernate.BOOLEAN).list();



can anybody give me en example in HQL?


Last edited by 4lbert on Thu Jul 06, 2006 5:37 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 5:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
read my previous answer - you can define special/custom functions in the Dialect.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 5:07 am 
Newbie

Joined: Tue Jul 04, 2006 12:32 pm
Posts: 4
where can I define my dialect?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 5:10 am 
Newbie

Joined: Tue Jul 04, 2006 12:32 pm
Posts: 4
by the way:

you life in switzerland? Do you speak german?
I'm from lucern.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 5:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://www.hibernate.org/hib_docs/v3/re ... l-dialects

...and then just extend it and add your functions.

btw. in 3.2 you can do it in the mapping file or directly on the Configuration object.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 5:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
...and yes my location is Neuchatel, Switzerland.

I do speak (some kind) of german, but my native tounge is Danish ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.