[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6353) DetachedCriteria: get sql alias used for sql projection or sql restriction

Dave (JIRA) noreply at atlassian.com
Wed Jun 22 22:16:54 EDT 2011


DetachedCriteria: get sql alias used for sql projection or sql restriction
--------------------------------------------------------------------------

                 Key: HHH-6353
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6353
             Project: Hibernate Core
          Issue Type: Improvement
          Components: query-criteria
         Environment: Java 6, Jboss 5.1.0, Hibernate 3
            Reporter: Dave


A method to get sql alias is needed from DetachedCriteria in order to use 
non-root entity alias in sql restriction or sql projection.

DetachedCriteria:
String getSqlAlias(String alias)   // alias has been created

detachedCriteria.createAlias("group","g");
String sqlAlias = detachedCriteria.getSqlAlias("g");

detachedCriteria.add(Restrictions.sqlRestriction(sqlAlias + ".name='John'"));
detachedCriteria.setProjection(Restrictions.sqlProjection(sqlAlias + ".name"));

-- 
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