Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sorting problem with HibernateSqlQuery with Websphere

 
Ranjan Shri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks in advance.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranjan Shri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic