Hello.

It looks like OPENJPA-2849 changes broke a few things.

UnaryOp is used for a *lot* of cases, and after the fix, it
exclusively uses the type reported by the expression implementation
(which is then "converted" using DBDict). I understand the reason for
the fix, but, unfortunately, the expressions don't determine their
types well, so now we have a new set of problems.

For example (on PG):
cb.case() always reports type Object. Any select expressions with that
case (not case(Expression) though)), result in an attempt to load
serialized java class data from the result set.

This query now returns longs, despite explicitly asking it to return
integers, and despite the fact that the field used in "select"
expression (log.line) is 'int':

// now fails with ClassCastException - Long can't be cast to Integer
int lastLine =
        em.createQuery("select coalesce(max(log.line), 0) from Log log
where log.job = :job",
                    Integer.class)
                .setParameter("job", job)
                .getSingleResult();


-- 
With best of best regards
Pawel S. Veselov

Reply via email to