[hibernate-dev] How to deal with a constant in CriteriaQuery

Christian Beikov christian.beikov at gmail.com
Wed Apr 25 02:51:32 EDT 2018


Am 25.04.2018 um 00:46 schrieb Steve Ebersole:
>
>
> On Tue, Apr 24, 2018 at 5:43 PM Christian Beikov 
> <christian.beikov at gmail.com <mailto:christian.beikov at gmail.com>> wrote:
>
>     That's a possibility indeed, but there will most likely always be
>     some
>     nice function that uses a weird keyword syntax for which there is no
>     first class support.
>
>
> And not only that but some databases allow extensions to the SQL spec 
> as to what can be extracted.  So using an enum is nice, but limiting
>
>     So even if we propose this, IMO we should still also propose to add a
>     note to the function invocation syntax section, that a function may
>     resolve to a JPA vendor defined funciton as well. This would be
>     like a
>     "last resort" to use a function at least in a "standard way". If
>     the JPA
>     vendor doesn't define the desired function, it's up to the user to
>     making use of JPA vendor specific APIs for registering the function.
>
>
> I'm not sure what this means
That means that section 4.6.17.3 should be changed to allow for 
FUNCTION('XYZ', arg1, ...) to resolve to a JPA vendor specific function 
like the ones registered in a Hibernate Dialect. To me it seems that 
currently the wording requires to pass this through to the SQL directly 
as XYZ(arg1). This would allow the use of user defined SQLFunctions 
through the JPA Criteria API.


More information about the hibernate-dev mailing list