You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Pawel Veselov <pa...@gmail.com> on 2015/08/25 09:49:10 UTC

strange coalesce?

Hi.

In OpenJPA 2.2.2, with this CB query:

CriteriaBuilder cb = ...getCriteriaBuilder();
CriteriaQuery<Long> q = cb.createQuery(Long.class);
Root<E_UpdateCurrent> root = q.from(E_UpdateCurrent.class);
Expression<Boolean> installed =
        cb.coalesce(root.get(E_UpdateTarget_.installed), cb.literal(false));
q.where(cb.isFalse(installed));
q.select(cb.count(root));
entityManager.createQuery(q).getSingleResult();

Generates the following SQL:

891973  Snap  TRACE  [ajp-nio-9181-exec-107] openjpa.jdbc.SQL - <t
802018654, conn 982796314> executing prepstmnt 408515169 SELECT
COUNT(t0.id) FROM current_updates t0 WHERE (
COALESCE(t0.installed,true) = ?) [params=?]

I assume the '?' will be 'false'

Do I understand correctly this looks like a bug? E_UpdateTarget.installed
is a boolean field.


Thanks!

  Pawel.