NamedQuery error "Type mismatch: number type expected" and "Orderable attribute of the entity been selected expected"

I've two named queries in my project that aren't with errors (it works when running) but IntelliJ IDEA shows some errors.

The first is at the last line of the above query. It says "Type mismatch: number type expected", pc.dataPrevisao is a DATE field. Why IDEA says it's an error if it works?

import javax.persistence.NamedQuery;
            query="select ep from EstoqueProgramado ep " +
                "join ep.DI di join di.pedidosCompra pc " +
                "where coalesce(ep.produto.familia.mostrarSite, 'S') <> 'N' and " +
                "  ep.quantidade > 0 and " +
                "  pc.dataPrevisao between CURRENT_DATE and :dataPrevista"

The second is in this order by "order by pc.dataPrevisao, di.programado, ep.produto, ep.cor", it says "Orderable attribute of the entity been selected expected" on ep.produto and ep.cor. Both are entities that implements Comparable so they are "orderable".

Is this a bug? How could I solve this?

Felipe Cypriano

Comment actions Permalink

"Orderable attribute..." seems to be registered as a jira:
Are you using an older version than 7.0.3 ? By doing ALT-RETURN with cursor on it you should be able to suppress that warning permanently for all files if you want to.

I guess "Type mismatch: number type expected" is a similar bug.

Comment actions Permalink

That's a bug, I've filed a JIRA issue: You may watch it to
be notified on the progress.

Comment actions Permalink

No, I'm using IDEA 8.1 #9732.

When I type ALT+RETURN on it I've some options to disable inspection, but it seems to diable all of the inspection. I'd like to have a correct inspection and not ignore it completely.

The bug that you mention seems to be valid when ordering entities instead of "primitive types".

This is the line where the error occur:
"order by pc.dataPrevisao, di.programado, ep.produto, ep.cor"

These are the attributes "produto" and "cor":
//public class Produto implements Serializable, Comparable<Produto>
private Produto produto;

//public class Cor implements Serializable, Comparable<Cor>
private Cor cor;

Should the bug IDEADEV-25141 be reonpened?


Please sign in to leave a comment.