michael wrote:
Of course you have to use the name of the property, not the column name.
Yes, that's how I think it should be, but if I change the query in my original posting to
return session.createQuery("from EnumPatternLevel epl where epl.serialNo=:serialNo order by serialNo, runCode, applicabilityDate, enumGroup, ord").
setInteger("serialNo", serialNo).
list();
i.e. by using the property names in the order by clause, I get:
Caused by: com.sybase.jdbc2.jdbc.SybSQLException: Invalid column name 'serialNo'.
at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2884)
at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:2206)
at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:220)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:203)
at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1596)
at com.sybase.jdbc2.jdbc.SybStatement.executeQuery(SybStatement.java:1581)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:96)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:71)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:107)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1183)
at org.hibernate.loader.Loader.doQuery(Loader.java:363)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
at org.hibernate.loader.Loader.doList(Loader.java:1499)
... 93 more
In Hibernate 2 I had to use the column names, but there the # in serial# was accepted.
Are we still discussing whether this is pilot error or are we getting close to submitting a bug report ?
- Erik