Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Sorting problem with HibernateSqlQuery with Websphere

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic