openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Select NEW Issues
Date Sat, 31 Oct 2009 02:19:07 GMT

Hi,
  JPQL implementation of OpenJPA 1.3 (or before) had this limitation: if you
specify a NEW in select projection then rest of the projection clauses are
silently ignore.
  This is in agreement with your observation.
   The good news is, the latest version of OpenJPA does not have any such
restriction.

Pinaki


dharga wrote:
> 
> So I'm pretty new to using OpenJPA so this might be a simple fix...
> 
> I'm doing the following query.
> 
> select new com.bcbst.odstats.ejb.beans.RangeStats(count(a),
> avg(a.loadTime)) 
> FROM ODUsage a 
> WHERE 
>   a.accessDate BETWEEN :startDate AND :endDate and 
>   a.loadTime is not NULL
> 
> I've noticed the following.  If I remove the AVG aggregation function (and
> change the RangeStats constructor accordingly) it works fine in all cases.
> 
> The whole function is here.
> http://aluink.pastebin.com/m49bbacb8
> 
> The RangeStats class is here
> http://aluink.pastebin.com/m54beb0d
> 
> When I try to loop and do several queries I get this error. 
> http://aluink.pastebin.com/m164f3d96
> 
> I've also noticed that if do the query just once with static :startDate
> and :endDate parameter values it works fine.  If I run a loop over a date
> range which includes the static date previously used, it fails.
> 
> The end goal is to reproduce the following transact-sql query and have the
> values in somekind of bean.  I really don't like the idea of doing
> multiple queries, but have yet to find a better solution.  I'm open to
> idea.
> 
> SELECT count(*), avg(loadTime), month(accessDate) 
> FROM Table 
> WHERE 
>   accessDate BETWEEN :startDate AND :endDate 
> GROUP BY month(accessDate)
> 
> TIA!
> 
> 


-----
Pinaki 
-- 
View this message in context: http://n2.nabble.com/Select-NEW-Issues-tp3921134p3922563.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message