[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5583) Allow a more flexible mechanism for adding new functionality to HQL

Fabio adriano Lisboa Gomes (JIRA) noreply at atlassian.com
Sun Sep 19 22:50:22 EDT 2010


Allow a more flexible mechanism for adding new functionality to HQL
-------------------------------------------------------------------

                 Key: HHH-5583
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5583
             Project: Hibernate Core
          Issue Type: New Feature
          Components: query-criteria, query-hql
            Reporter: Fabio adriano Lisboa Gomes


Why not allow a more flexible mechanism for adding features not provided by HQL?

Perhaps an escape mechanism, which can be placed in any position in the HQL. The HQL parser could call a method, for example, {{String escapeTranslator(String input)}}. Each dialect could have an implementation of this method. The default implementation could return the escape characters unchanged.

The absence of a more flexible mechanism forces the use of hacks like the one described in the blog [http://www.znetdevelopment.com/blogs/2009/10/07/using-use-index-with-hibernatemysql/].

*For example*:

Suppose the escape characters are delimited by  slash slash (//). So we could write

  {{String HQL = select u from User u //use index (my_index)//}}

If no specific implementation of {{escapeTranslator (..)}} is provided, the HQL parser could return

  {{select u from User u use index (my_index)}} 

This implementation is very flexible and at the same time, portable, since different dialects could provide their own implementations of the {{scapeTranslator}} method.

The escape delimiters characters could be defined by

 {{query.setEscapeDelimiter (String begin, String end)}}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list