[jboss-user] [EJB 3.0] - EJB QL requires useless item in select list

owaind do-not-reply at jboss.com
Tue Dec 19 07:03:40 EST 2006


I have the following EJB QL

select r.channel.id,  sum(se.currentListeners), r from Request r
left join fetch r.channel c
left join fetch r.stats s
left join fetch s.statsEntries se
where r.createdDate > :startDate and r.createdDate < :endDate
group by r.channel

i want to get rid of the r in the select list but it wont let me, can anyone tell me why? in normal sql i wouldnt need the r in the select list. The problem is it takes time to instantiate those Request objects and its totally wasted. I want it to look like this:

select r.channel.id,  sum(se.currentListeners) from Request r
left join fetch r.channel c
left join fetch r.stats s
left join fetch s.statsEntries se
where r.createdDate > :startDate and r.createdDate < :endDate
group by r.channel

lovely that would involve no wasted effort and speed up my query. Can anyone help me i dont understand why i need the r in the select list, is hibernate dumb?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994954#3994954

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994954



More information about the jboss-user mailing list