[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4921) 3.5 (JPA 2) doesn't allow order by alias

Tomasz Bech (JIRA) noreply at atlassian.com
Tue Feb 16 07:30:47 EST 2010


3.5 (JPA 2) doesn't allow order by alias
----------------------------------------

                 Key: HHH-4921
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4921
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.0-CR-1
            Reporter: Tomasz Bech
         Attachments: JPAQLComplianceTest.java

I've created following test case in JPAQLComplianceTest.java:
	public void testOrderByAlias() {
		Session s = openSession();
		s.createQuery( "select c.name as myname FROM Item c ORDER BY myname" ).list();
		s.close();
	}
and it fails:

Caused by: java.sql.SQLException: Column not found: MYNAME in statement [select item0_.NAME as col_0_0_ from EJB3_ITEM item0_ order by myname]
	at org.hsqldb.jdbc.Util.throwError(Unknown Source)
	at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
	at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1598)
	at org.hibernate.loader.Loader.doQuery(Loader.java:718)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:271)
	at org.hibernate.loader.Loader.doList(Loader.java:2273)
	... 30 more


Spec says in '4.9 ORDER BY Clause' that 'order by alias' is supported by JPA 2.



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