Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate Version:
3.2.0
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'score' in 'order clause'
[tf:BPMController] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
[tf:BPMController] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2822)
[tf:BPMController] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1536)
[tf:BPMController] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1626)
[tf:BPMController] at com.mysql.jdbc.Connection.execSQL(Connection.java:3031)
[tf:BPMController] at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:943)
[tf:BPMController] at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1049)
[tf:BPMController] at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
[tf:BPMController] at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
[tf:BPMController] at org.hibernate.loader.Loader.getResultSet(Loader.java:1668)
[tf:BPMController] at org.hibernate.loader.Loader.doQuery(Loader.java:662)
[tf:BPMController] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
[tf:BPMController] at org.hibernate.loader.Loader.doList(Loader.java:2144)
[tf:BPMController] ... 11 more
MyHql:
select new com.printrak.bpm.transaction.Respondent(file.Case.id, length(:data, file.data) as length) from DData as file order by length desc
MySql:
select fingerfdpd0_1_.djid as col_0_0_, omm(?, fingerfdpd0_.data) as col_1_0_ from DData fingerfdpd0_ inner join BData fingerfdpd0_1_ on fingerfdpd0_.id=fingerfdpd0_1_.id order by length desc
(show_sql=true):
t:
Hql replaces length in "oder clause" with "col_1_0_"
How can I prevent hibernate from converting col name from length to col_1_0_. I don't want to have to call length() once again in the order by clause. I don't think this is a bug, I am probably missing something. I bought hibernate book and couldn't find answers there either. Thanks in a dvance.