Sorting problem with HibernateSqlQuery with Websphere
Ranjan Shri
Greenhorn
Joined: Jun 24, 2008
Posts: 3
posted
0
Hi,
I am using Hibernate sql query to query some result set from database(Oracle 10G). Sql has orderby clause in it so that result are sorted by the sql itself.
Now the sql with sorting is working fine on Jboss, Weblogic. But on websphere sorting is not working though the results are same.
Originally posted by Paul Sturrock: What you say sounds very surprising. The container does't play any part in ordering of SQL results sets.
How do you sort your results? Can you show us the SQL you use and the code you call the query from?
I have a employee table having employeeid, employee name and address as it fields. Sql being used is select employeeid, employeename, address from emplyoee order by 2 asc
Code is pretty stright forward SQLQuery sqlQuery = createQuery(queryString); where queryString is above mentioned query and createQuery is a private method which gets the SQLQuery object form HibernateSessionImpl
Returned resultset is not sorted correctly in websphere
What does createQuery(queryString) do? Does it keep the column order as defined in your query? Using "order by 2" requires a fixed column order. What happens if you change this to "order by employeename", is the ordering more consistant?
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Sorting problem with HibernateSqlQuery with Websphere