Consulta JPQL

03/03/2023

0

public PagingQuery<PropostaGerador> findProposta(PagingQuery<PropostaGerador> pq, Boolean rel) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
QueryParameters qp = rel ? new QueryParameters("", QueryType.DYNAMIC) : gridFiltro.getDocument().newQueryParameters("", QueryType.DYNAMIC);
String jpql = "SELECT distinct O FROM PropostaGerador o INNER JOIN o.listaEquipamentosGerador i where o.id = o.id ", id = "", cliente = "", statusDocumento = "",
equipamento = "", orderBy = " ORDER BY o.id";
if (txtId.getValueWithNull() != null) {
id = " and o.id=:id ";
qp.add("id", Long.valueOf(txtId.getValue()));
}
if (txtCodCliente.getValueWithNull() != null) {
cliente += " and o.cliente.id = :cliente";
qp.add("cliente", txtCodCliente.getValueLong());
}
if (cmbStatus.getKeySel() != null) {
statusDocumento = " and o.status = :status ";
qp.add("status", StatusDocumento.valueOf(cmbStatus.getKeySel()));
}
if (txtCodEquipamento.getValueWithNull() != null) {
equipamento += " and i.equipamento.id = :equipamento";
qp.add("equipamento", txtCodEquipamento.getValueLong());
}
jpql = String.format(jpql + " %s %s %s %s %s", id, cliente, statusDocumento, equipamento, orderBy);
qp.setQuery(jpql);
return facade.find(qp);
}


esta consulta me retorna apenas as propostas que tenham algo da listaEquipamentosGerador, alguem sabe como faz para retornar os que também não tenham
Pierre Iost

Pierre Iost

Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar