[jboss-user] [EJB 3.0] - Re: @NamedQuery and setting orderBy as a parameter?
do-not-reply at jboss.com
Tue Jan 30 20:36:22 EST 2007
Just from my database experience I would say that it is not possible. Any sane JPA-Provider will execute the query using a PreparedStatement and any sane JDBC driver will excute a prepared statement using bind variables.
AFAIK bind variables can only represent SQL literals like strings, numbers and dates but they can not be replaced by a database object like a column.
So your named query would result in something
| SELECT * FROM TBL_HOT_CONTENT ORDER BY 'viewsWeekly desc'
and this will not work for obvious reasons. Please correct me if I am wrong.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008590#4008590
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4008590
More information about the jboss-user