Galera to fazendo um projeto novo em sima de um banco de dados existente desde 2001 da empresa aonde trabalho, o firebird 1.5, faze o que o banco nao ta de troca…
enfim to com um problema no ilike
codeigo gerado pelo hibernate
select
this_.CLIENTE_ID as CLIENTE1_3_0_,
this_.CLIENTE_AVISOVENCBOLETO as CLIENTE2_3_0_,
this_.CLIENTE_CEI as CLIENTE3_3_0_,
this_.CLIENTE_CELULAR as CLIENTE4_3_0_,
this_.CLIENTE_CHAVEDISPONIVEL as CLIENTE5_3_0_,
this_.CLIENTE_CPFCNPJ as CLIENTE6_3_0_,
this_.CLIENTE_DATAALTERACAO as CLIENTE7_3_0_,
this_.CLIENTE_DATACADASTRO as CLIENTE8_3_0_,
this_.CLIENTE_DATAINATIVO as CLIENTE9_3_0_,
this_.CLIENTE_DATANASC as CLIENTE10_3_0_,
this_.CLIENTE_DTHISTHARDWARE as CLIENTE11_3_0_,
this_.CLIENTE_EMAIL as CLIENTE12_3_0_,
this_.CLIENTE_FANTASIA as CLIENTE13_3_0_,
this_.CLIENTE_FAX as CLIENTE14_3_0_,
this_.CLIENTE_FISICAJURIDICA as CLIENTE15_3_0_,
this_.CLIENTE_FONE as CLIENTE16_3_0_,
this_.CLIENTE_HISTHARDWARE as CLIENTE17_3_0_,
this_.CLIENTE_INSCESTADUAL as CLIENTE18_3_0_,
this_.CLIENTE_NOME as CLIENTE19_3_0_,
this_.CLIENTE_NOMEIDENT as CLIENTE20_3_0_,
this_.CLIENTE_NUMEROVOZIP as CLIENTE21_3_0_,
this_.CLIENTE_NUMREGISTRO as CLIENTE22_3_0_,
this_.CLIENTE_PGTOMENSALIDADE as CLIENTE23_3_0_,
this_.CLIENTE_QF as CLIENTE24_3_0_,
this_.CLIENTE_RAMOATIV as CLIENTE25_3_0_,
this_.CLIENTE_RECEBERINF as CLIENTE26_3_0_,
this_.CLIENTE_RESPONSAVEL as CLIENTE27_3_0_,
this_.CLIENTE_SENHA as CLIENTE28_3_0_,
this_.CLIENTE_SITUACAO as CLIENTE29_3_0_,
this_.CLIENTE_TIPO as CLIENTE30_3_0_,
this_.CLIENTE_TIPOLICENCIAMENTO as CLIENTE31_3_0_,
this_.CLIENTE_TIPOPROTECAO as CLIENTE32_3_0_,
this_.CLIENTETIPO_ID as CLIENTE33_3_0_,
this_.PARAMBLOQUETO_ID as PARAMBL34_3_0_,
this_.RAMOATIVIDADE_ID as RAMOATI35_3_0_,
this_.RAMOATIVIDADEAUX_ID as RAMOATI36_3_0_,
this_.REPRESENTANTE_ID as REPRESE37_3_0_
from
CLIENTE this_
where
UPPER(this_.CLIENTE_NOME) like ?
and this_.CLIENTE_SITUACAO=?
codigo metodo que gera a consulta
query = query.toUpperCase();
Criterion criterion = null;
System.out.println(query);
if(OsirisUtils.isInteger(query)) {
criterion = Restrictions.like("clienteNumregistro", query + "%", MatchMode.START);
} else {
criterion = Restrictions.ilike("clienteNome", query + "%", MatchMode.START);
}
Criteria criteria = getSession().createCriteria(getClazz())
.add(criterion)
.add(Restrictions.eq("clienteSituacao", ConstantesOsiris.TP_SITUACAO_ATIVO));
return criteria.list();
como no firebird 1.5 não existe a funcao lower implementei um dialeto novo extendento o proprio firebird, aqui esta o que eu fiz
public class Firebird15Dialect extends FirebirdDialect {
@Override
public String getLowercaseFunction() {
return "UPPER";
}
}
se eu executo a consulta direto no banco funciona perfeitamente, mas atraves do hibernate não funciona, sabem porque ?