[hibernate-dev] HQL and spatial

Steve Ebersole steve at hibernate.org
Mon Nov 2 10:16:35 EST 2015


Karel,

Any further thoughts?

I looked over the link you gave in regards to literals, but did not fully
understand.  I'd prefer this follow some "escape syntax" form, beyond that
maybe you could just enumerate the literal types you'd want to support and
their formats.

ALso, I have not seen any discussion around "boolean-function-expressions
as predicates" on SQM-15...


On Thu, Sep 10, 2015 at 7:12 AM Steve Ebersole <steve at hibernate.org> wrote:

> It is true that not all applications use spatial, or even that DB’s
>> support (all) spatial functions. But it would help to ensure consistency in
>> the available dialects. Now this consistency is tested for in the
>> integration tests, so not having this at the grammar isn’t a big problem.
>>
>
> Its up to you.  We can add it to the grammar and simply have it throw
> exceptions if those functions are not understood.
>
>
> Support for spatial literals would be a great plus. In my opinion, the
>> best candidate for HQL spatial literals is the Postgis EWKT format (
>> http://postgis.net/docs/manual-2.1/using_postgis_dbmanagement.html#EWKB_EWKT),
>> which is a sane, and popular extension of the purely 2D WKT standard. It
>> is  supported in the geolatte-geom library and many others. I can help by
>> writing a grammar for this.
>>
>
> What I have done thus far in SQM grammars is to borrow from the idea of
> "JDBC escape syntax".  So for example, to define a timestamp literal one
> would say `{ts '2015-10-10 ...'}`
>
>
> There is also at least one HQL syntax change that would help implement
>> spatial functions:  function invocations that evaluate to boolean should be
>> regarded as valid boolean expressions. The HQL currently doesn’t seem to
>> allow this, so I needed to wrap them in equality expressions. But then
>> MySQL wouldn’t use its spatial index (as I wrote before, although I
>> mistakenly wrote “spatial query” in my original email).
>>
>
> This would require some knowledge of the "metadata" of a function, which
> is not there in SQM at all so far.  Here, I'd have to know the return type
> of the referenced function.  We can contemplate that.
> https://hibernate.atlassian.net/browse/SQM-15
>
>
>


More information about the hibernate-dev mailing list