EclipseLink - Consulta com LIKE e CAST(... AS ...) MySql

Olá pessoal,

Gostaria de saber se alguém pode me ajudar com o seguinte problema:

Tenho o método abaixo, mas esta gerando a exceção
"Exception Description: Syntax error parsing the query [SELECT a FROM Aluno a WHERE 1=1 AND a.nome LIKE :nome AND CAST(a.matricula AS CHAR) LIKE :mat AND CAST(a.cr AS CHAR) LIKE :cr AND a.orientador LIKE :orientador], line 1, column 63: unexpected token [(].".

@SuppressWarnings(“unchecked”)
public static List getVariosCampos(String pmat, String pnome, String pcr, String porientador) {

    if (pnome == null) {
        throw new RuntimeException("Error...");
    }

    String sql = "SELECT a FROM Aluno a WHERE 1=1 " +
                 " AND a.nome LIKE :nome" +
                 " AND CAST(a.matricula AS CHAR) LIKE :mat" +
                 " AND CAST(a.cr AS CHAR) LIKE :cr" +
                 " AND a.orientador LIKE :orientador";
    Query query = manager.createQuery(sql);
    query.setParameter("nome", "%"+pnome+"%");
    query.setParameter("mat", "%"+pmat+"%");
    query.setParameter("cr", "%"+pcr+"%");
    query.setParameter("orientador", "%"+porientador+"%");

    List<Aluno> result = query.getResultList();

    return result;


 }//Fim public static List<Aluno> getVariosCampos(String name)

Se eu rodar a consulta direto no banco funciona perfeitamente,

"
select id, matricula, nome from aluno a
where 1=1
and a.nome like '%%'
and CAST(a.matricula AS CHAR) like '%56%'
and CAST(a.cr AS CHAR) like '%%'
and a.orientador like ‘%%’;

"

Parece que o erro ocorre quando o método “Query query = manager.createQuery(sql);” alguém sabe o que pode ser?

Desde já agradeço.

Qual versão do EclipseLink vc está usando?

A função CAST só é suportada a partir da versão 2.4.