openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dharga <>
Subject Select NEW Issues
Date Fri, 30 Oct 2009 19:54:49 GMT

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 
  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.

The RangeStats class is here

When I try to loop and do several queries I get this error.

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 
  accessDate BETWEEN :startDate AND :endDate 
GROUP BY month(accessDate)


View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message