[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3315) Criteria API to accept SQL strings in the orderBy clause

Avlesh Singh (JIRA) noreply at atlassian.com
Fri May 30 03:56:34 EDT 2008


Criteria API to accept SQL strings in the orderBy clause
--------------------------------------------------------

                 Key: HHH-3315
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3315
             Project: Hibernate3
          Issue Type: Improvement
          Components: query-criteria
         Environment: Hibernate3, MySQL 4.1
            Reporter: Avlesh Singh
            Priority: Minor


The criteria interface accepts an "Order" in the addOrder method to sort the resultset. This is how it currently works:
Criteria queryCriteria = session.createCriteria(MyBean.class);
queryCriteria.addOrder(Order.asc("myBeanProperty"));

In my specific case, I needed a sql expression instead of a property name. The Order class had no specific method (unlike the Expression class) to use a sql string instead of the "property" itself. I would have loved to see a 
public static org.hibernate.criterion.Order sql(java.lang.String sqlString){}
implementation in the Order class. 

Alternatively, The Criteria interface can have this method -
org.hibernate.Criteria addOrder(java.lang.String sqlString);

I feel its a nice to have feature.

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