java - QueryDsl: Select count of rows that meets the criteria -


i have 2 records in db. this:

qloginregistryentry loginregistryentry = qloginregistryentry.loginregistryentry; jpaquery query = new jpaquery(jpa.em()); list<loginregistryentry> result; result = query.from(loginregistryentry)               .where(loginregistryentry.indate.startswith(yearandmonth))               .list(loginregistryentry);  system.out.println(result.size()); 

it return 2, correct

when this:

qloginregistryentry loginregistryentry2 = new qloginregistryentry("a"); long count = query.from(loginregistryentry2).count(); system.out.println(count); 

it return 4, wrong

what doing wrong? how should download count of rows meets criteria?

i don't think executed queries in isolation. reused query object first query , continued, got cross join , got 2 * 2 = 4 results.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -