• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Aggregate function in HQL

 
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
i am using the below query in my program..



here when i am retrieving the value using query.list, it returns the object, the problem is the object is not of type TwaevntRsrcRt as expected.

and also i tried to create a new class having the values listed in select list, still thats too failed



Throwing the error Class Not Found Exception.... i placed the ResourceDetails class in class path. is some where i need to mention the file name..

any idea wheres the problem....
Thanx in advance
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aggregate queries always return a list of Object[], in your case:

See 3.4.1.2. Scalar results.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Reynders,
Thanx for ur reply,
i am facing certain problems listed below...

1) the query is not returning the list of array objects its retuning just list of objects
2) There is no function available named getResultList() for a query object.

Can you help me out???

ThanX
Param.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For Hibernate 2 please refer to 9.3.1. Scalar queries.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i went through the 9.3.1 section which i listed below.



in the example given above the "results.next()" will always return the object not array of objects, but how they given the example in which results.next returns the array of object, is there any version problem, i am using the Hibernate 2.1.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you look at the Session interface you will notice that the deprecated iterate method returns a java.util.Iterator. So that interface is the "limitation"; the iterator's next() method returns an Object. So that code snippet is just sloppy. The line probably should read:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic