[postgis-users] Postgis Java Geometry classes/Hibernate, broken query
Dave Potts
dave.potts at pinan.co.uk
Fri Dec 1 11:43:38 PST 2006
Hi Folks,
I tried this, type the query in via psql, that worked corretly (I had to
expand the :varible arguments)
But if I did I ask hibernate to do it, it get it broken.
By query is
Query query = session
.createQuery("select manor "
+ " from "+
" CastleDTO as srcCastle, "+
" PlaceNameDTO as manor inner join
manor.county as county " +
" where srcCastle.castleName= :name and
manor.county.countyName= :county and " +
"
manor.geometry is not null and "+
" distance(manor.geometry,
srcCastle.geometry) < :foobar ");
> query.setString("name", name);
> query.setString("county", county);
> query.setString("foobar", distance);
Where name = guidlford, county= surrey, distance= 3000
Results with hibernate
select placenamed1_.place_name_id as place1_3_, placenamed1_.place_name
as place2_3_, placenamed1_.hundred_id as hundred3_3_,
placenamed1_.county_id as county4_3_, placenamed1_.ngr as ngr3_,
placenamed1_.gis_ngr as gis6_3_ from castle_table castledto0_,
place_name_table placenamed1_ inner join county_table countydto2_ on
placenamed1_.county_id=countydto2_.county_id where
castledto0_.castle_name=$1 and countydto2_.county_name=$2 and
(placenamed1_.gis_ngr is not null) and distance(placenamed1_.gis_ngr,
castledto0_.gis_ngr)<$3]
Dave.
======================================
By setting the property
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
in the Hibernate config xml, you'll see all the sql calls sent by Hibernate
in the console.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dave.potts.vcf
Type: text/x-vcard
Size: 85 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061201/47d3542f/attachment.vcf>
More information about the postgis-users
mailing list