File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes JPQL help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "JPQL help" Watch "JPQL help" New topic
Author

JPQL help

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

The query below,

SELECT d, COUNT(e), MAX(e.salary), AVG(e.salary)
FROM Department d JOIN d.employees e
GROUP BY d
HAVING COUNT(e) >= 5

What is the actual Result Type of the query above.

When I say SELECT e FROM EMPLOYEES e, the result type of the query is EMPLOYEES. Similarly for the above SELECT statement, what would be the Result Type? Help needed guys!


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

The result type is Object[]

Thanks


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Originally posted by Narendra Dhande:
Hi,

The result type is Object[]

Thanks


How do you say that?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Ok I got this,

The array of Object result occurs whenever a query involves more than one expression in the SELECT clause.

Thanks for the help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPQL help
 
Similar Threads
Is this type of group by query possible in JPA ?
SubQuery in Hibernate
Joins in Hibernate
JDBC Newbie
Avg(...) aggregate function