On Wed, 22 Dec 2004 06:10:57 -0600, Alexey Loubyansky <[EMAIL PROTECTED]> wrote:

Looks nice.

Stupid question again from me - any reason why you use ?1 syntax and not just ? or :name here ?
(Just to keep the syntaxes for placeholders down at a minimum ,)


/max

This is committed now.
To define a new function template you create an instance of
SQLFunctionTemplate which implements SQLFunction and register it in a
dialect as any other SQLFunction, e.g.

      registerFunction("locate", new
SQLFunctionTemplate(Hibernate.INTEGER, "locate(?1, ?2, ?3)"));

By the spec, this locate function might have 2 or 3 parameters. So, you
define 3 in the template but can pass just 2.

If the template is not found for a specific dialect when generating SQL,
the function will appear in the generated SQL as it appears in the
EJB/H-QL statement. I.e. it is how it worked before.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Alexey Loubyansky
Sent: Wednesday, December 22, 2004 12:39 PM
To: Max Andersen; Hibernate development
Subject: RE: [Hibernate] new template-based hql functions

> > concat(?1 || ?2) is parsed not as one argument but three,
> since there
> > are three tokens, i.e. ?1, || and ?2.
>
> oh - afraid of sounding stupid, but shouldn't that be parsed as a
> functioncall(expression) ?
> where expression is (x op y) in this case ?

Yes, sorry, of course, it is parsed like this.
I had a bug in creating an argument list. It works now.

Thanks.


------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel




-- Max Rydahl Andersen callto://max.rydahl.andersen

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]
http://jboss.com


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to