criteria API: select count(*) from .. [message #487130] |
Tue, 22 September 2009 01:27  |
Eclipse User |
|
|
|
Is it correct usage?
EntityManager em = getEntityManager();
try {
QueryBuilder qb = em.getQueryBuilder();
CriteriaQuery cq = qb.createQuery();
Root<DiscountCode> dc = cq.from(DiscountCode.class);
cq.select(qb.count(dc));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
if yes, then I got two issues here in eclipselink 2.0 M7, return value
is double (may be known issue
https://bugs.eclipse.org/bugs/show_bug.cgi?id=289830)
and value is powered in two, i.e. if I have 6 rows result will be 36.0,
after addition of one more row I have result 49.0, it may be somehow
related to issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=245653
but may be another one.
|
|
|
|
|
|
|
|
Re: criteria API: select count(*) from .. [message #488000 is a reply to message #487894] |
Fri, 25 September 2009 05:18  |
Eclipse User |
|
|
|
Serge пишет:
> Serge пишет:
>> Serge пишет:
>>
>>> ok, I can try, where I can find dayly builds of el 2.0?
>>
>>
>> found nightly myself, will try
>
> looks fixed in 090921, will reverify tomorrow
and 090925 have both issues fixed, thanks
|
|
|
Powered by
FUDForum. Page generated in 0.07019 seconds