# Filtrar por atributos referenciados

Tenemos un entity referenciado y deseamos filtrarlo por clasificacion de cliente.![](/files/-Lc1X8fsHUtx0cbAUi9F)

Referenciados:

### Cliente

![](/files/-Lc1X8fuWAI-Rq2832Du)

### Clasificacioncliente

![](/files/-Lc1X8fwhU3z-Q74vsaH)

```java
<b:column medium-screen="8">
  <p:outputLabel value="#{msg['field.clasificacioncliente']}"/>                                 
  <e:autocompleteclasificacioncliente listener="#{clienteController.searchBy('clasificacioncliente')}"
                    value="#{clienteController.lookupStoreejbServices.clasificacioncliente}"
                    itemLabel="#{p.descripcion}"
                    dropdown="true"
                    required="false"
                    minQueryLength="0"
                    field="descripcion"
                    update=" :form:dataTable" />
 </b:column>
```

## Para el listener

```java
 // <editor-fold defaultstate="collapsed" desc="searchBy(String string)">
    @Override
    public String searchBy(String string) {
        try {

            loginController.put("searchcliente", string);

            writable = true;
            move();

        } catch (Exception e) {
            JsfUtil.errorMessage("searchBy()" + e.getLocalizedMessage());
        }
        return "";
    }// </editor-fold>
```

## En el move

Usamos el findPagination

```java
clienteList = clienteRepository.findPagination(doc, page, rowPage, new Document("nombre", -1));
```

```java
    public void move() {

        try {

            Document doc;
            switch (loginController.get("searchcliente")) {
               case "clasificacioncliente":
                    doc = new Document("clasificacioncliente.idclasificacioncliente", lookupStoreejbServices.getClasificacioncliente().getIdclasificacioncliente());
                    clienteList = clienteRepository.findPagination(doc, page, rowPage, new Document("nombre", -1));
                    break;

                default:

                    clienteList = clienteRepository.findPagination(page, rowPage);
                    break;
            }

            clienteFiltered = clienteList;

            clienteDataModel = new ClienteDataModel(clienteList);

        } catch (Exception e) {
            JsfUtil.errorMessage("move() " + e.getLocalizedMessage());
        }
    }// </editor-fold>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://avbravo-2.gitbook.io/trucosjakartaee/overview/listxtml/filtrar-por-atributos-referenciados.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
