Currently, I have a search with Criteria that brings me results normally, but I want to add an implementation of type NOT
to it.
Does anyone have an idea how I could do this?
I put in the code a comment with a possible idea of the implementation, but I did not succeed.
Here's the code part:
@SuppressWarnings({ "unchecked" })
public List<ContaCorrenteModel> findByContaClieAssinat(Short banco, Short agencia, Long conta) {
List<ContaCorrenteModel> ccModel;
public List<ContaCorrenteModel> findByContaClieAssinat(Short banco, Short agencia, Long conta) {
List<ContaCorrenteModel> ccModel;
ArquivoLog.escreverLog
("Iniciando consulta [ClienteDaoImpl] findByContaClieAssinat - Parametros utilizados:"
+ " Banco " + banco +" Agencia " + agencia + " Conta " + conta );
this.session = ConexaoHibert.getInstance();
switch (Principal.getBase()) {
case CENTRAL:
List<TbCntaCrrtClie> tbCntaCrrtClieList = new ArrayList<TbCntaCrrtClie>();
Criteria crit = this.session.createCriteria(TbCntaCrrtClie.class, "conta");
crit.add(Restrictions.eq("conta.cdBanc", banco));
crit.add(Restrictions.eq("conta.cdAgen", agencia));
// Restricao que tenho que Adicionar a consulta criteria //
crit.add(Restrictions.not("conta.nrOrdeTitl", new Long(2) ));
crit.setFetchMode("nrSequPessUnic", FetchMode.JOIN);
crit.setFetchMode("tbPenumUnic.nrSequClieFirmPodr", FetchMode.JOIN);
crit.setFetchMode("tbPenumUnic.tbRpreGrupCollection", FetchMode.JOIN);
crit.setFetchMode("nrSequNatzCnta", FetchMode.JOIN);
tbCntaCrrtClieList = crit.list();
ArquivoLog.escreverLog("Total de clientes CENTRAL: " + tbCntaCrrtClieList.size());
ccModel = ContaCorrenteModelAdapter.adapt(tbCntaCrrtClieList);
break;