Hibernate ORM
  1. Hibernate ORM
  2. HHH-2736

support for native/SQL query hints in HQL/Criteria (Oracle SELECT hints for example)

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.4.sp1
    • Fix Version/s: 4.3.0.Beta4
    • Component/s: query-criteria, query-hql
    • Labels:
      None
    • Last commented by a user?:
      true

      Description

      Hello Everybody

      In 2004 Gavin said: "I think we plan to add a Query.setQueryHint() method" (hibernate forum: http://forum.hibernate.org/viewtopic.php?p=2193761&sid=5cf2ec711851f726c700eb9f56c2866a ). But I still cannot find it in Hibernate Core/Hib. Annotation/Hib. EntityManager.

      Can this enhancement request be opened / reopened?

      It would be great for us to have such possibility.

      Kind Regards,
      Adam Wozniak

        Issue Links

          Activity

          Hide
          James R. Semple added a comment -

          We'd like this feature too. For example, we'd like to put the Sybase READPAST hint in some of our HQL queries.

          Thank you kindly,
          James R. Semple

          Show
          James R. Semple added a comment - We'd like this feature too. For example, we'd like to put the Sybase READPAST hint in some of our HQL queries. Thank you kindly, James R. Semple
          Hide
          Marek Sadlowski added a comment -

          This feature is very needed!
          Otherwise development focused on assuring high performance db queries is limited to native queries.
          I think that javax.persistence.Query.setHint could be used for that purpose (is there really a need for separate method Query.setQueryHint ?).
          The most important is possibility of passing index hints and lock hints. Currently Hibernate limits this method's usage to
          "org.hibernate...." hints (even lock modes hints are ignored ).

          But looking at the history of this topic (not only in this JIRa but on other forums, the main question which comes to my mind is
          "Is really Hibernate team r

          Show
          Marek Sadlowski added a comment - This feature is very needed! Otherwise development focused on assuring high performance db queries is limited to native queries. I think that javax.persistence.Query.setHint could be used for that purpose (is there really a need for separate method Query.setQueryHint ?). The most important is possibility of passing index hints and lock hints. Currently Hibernate limits this method's usage to "org.hibernate...." hints (even lock modes hints are ignored ). But looking at the history of this topic (not only in this JIRa but on other forums, the main question which comes to my mind is "Is really Hibernate team r
          Hide
          Marek Sadlowski added a comment -

          Sorry I have not finished last question:
          Is any plan by Hibernate team to work on this feature in the near future?

          Show
          Marek Sadlowski added a comment - Sorry I have not finished last question: Is any plan by Hibernate team to work on this feature in the near future?
          Hide
          Hugh added a comment -

          This would be useful. I have dynamic table names defined by an in memory orm.xml per thread so NativeQueries don't quite cover it.

          Show
          Hugh added a comment - This would be useful. I have dynamic table names defined by an in memory orm.xml per thread so NativeQueries don't quite cover it.
          Hide
          Julien RENAUT added a comment -

          Bump.

          This feature is needed.

          Show
          Julien RENAUT added a comment - Bump. This feature is needed.
          Hide
          DELHOMMOIS added a comment -

          Hello,
          We developed it

          Vincent DELHOMMOIS
          Manager S.I. Logistique Automobile
          Tel : +33 (0)4 75 00 47 00
          Mob: + 33 (0)6 35 48 07 19
          P Pensez à l’environnement avant d’imprimer / Before printing, think about the environment.

          De : Julien RENAUT (JIRA) jira@hibernate.atlassian.net
          Envoyé : mercredi 24 avril 2013 17:10
          À : DELHOMMOIS, Vincent
          Objet : [JIRA] (HHH-2736) support for native/SQL query hints in HQL/Criteria (Oracle SELECT hints for example)

          https://www.jboss.org/dms/hibernate/images/jira/jiraheader_hibernate.png

          https://secure.gravatar.com/avatar/3d6d56f538d8ff97bf1f7c0f0a2a2db8?d=mm&s=48Julien RENAUT<https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=jrenaut> commented on [New Feature] HHH-2736<https://hibernate.atlassian.net/browse/HHH-2736>
          support for native/SQL query hints in HQL/Criteria (Oracle SELECT hints for example)<https://hibernate.atlassian.net/browse/HHH-2736>

          Bump.

          This feature is needed.

          This message is automatically generated by JIRA.
          If you think it was sent incorrectly, please contact your JIRA administrators
          For more information on JIRA, see: http://www.atlassian.com/software/jira

          Show
          DELHOMMOIS added a comment - Hello, We developed it Vincent DELHOMMOIS Manager S.I. Logistique Automobile Tel : +33 (0)4 75 00 47 00 Mob: + 33 (0)6 35 48 07 19 P Pensez à l’environnement avant d’imprimer / Before printing, think about the environment. De : Julien RENAUT (JIRA) jira@hibernate.atlassian.net Envoyé : mercredi 24 avril 2013 17:10 À : DELHOMMOIS, Vincent Objet : [JIRA] ( HHH-2736 ) support for native/SQL query hints in HQL/Criteria (Oracle SELECT hints for example) https://www.jboss.org/dms/hibernate/images/jira/jiraheader_hibernate.png https://secure.gravatar.com/avatar/3d6d56f538d8ff97bf1f7c0f0a2a2db8?d=mm&s=48 Julien RENAUT< https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=jrenaut > commented on [New Feature] HHH-2736 < https://hibernate.atlassian.net/browse/HHH-2736 > support for native/SQL query hints in HQL/Criteria (Oracle SELECT hints for example)< https://hibernate.atlassian.net/browse/HHH-2736 > Bump. This feature is needed. This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
          Hide
          Brett Meyer added a comment -

          https://github.com/hibernate/hibernate-orm/pull/554

          Incorporates pieces of the patches attached to HHH-6123 (modified) and adds a test case. I'd appreciate reviews before I push it.

          Show
          Brett Meyer added a comment - https://github.com/hibernate/hibernate-orm/pull/554 Incorporates pieces of the patches attached to HHH-6123 (modified) and adds a test case. I'd appreciate reviews before I push it.
          Hide
          Chris Watts added a comment -

          Is there plan to utilize http://docs.oracle.com/javaee/6/api/javax/persistence/QueryHint.html to allow Dialect specific hints?

          i.e my wish list is:
          @NamedQuery(name = "QueueMessage.bySystem", query = "select m from QueueMessage m where system = :system", hints=@QueryHint(name="SqlServer.ReadPast", value="true"))
          Would end up giving:
          Select field1, system from queue_message WITH (READPAST)

          Or even some way to extend the dialect to provide this functionality as needed.

          Show
          Chris Watts added a comment - Is there plan to utilize http://docs.oracle.com/javaee/6/api/javax/persistence/QueryHint.html to allow Dialect specific hints? i.e my wish list is: @NamedQuery(name = "QueueMessage.bySystem", query = "select m from QueueMessage m where system = :system", hints=@QueryHint(name="SqlServer.ReadPast", value="true")) Would end up giving: Select field1, system from queue_message WITH (READPAST) Or even some way to extend the dialect to provide this functionality as needed.
          Hide
          Brett Meyer added a comment -

          Bulk closing tickets resolved in released versions

          Show
          Brett Meyer added a comment - Bulk closing tickets resolved in released versions

            People

            • Votes:
              45 Vote for this issue
              Watchers:
              38 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development