Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's my best shot, names of the classes might be different</p> <pre><code> CriteriaBuilder qb = entityMan.getCriteriaBuilder(); CriteriaQuery&lt;Pedido&gt; criteriaQuery = qb.createQuery(Pedido.class); Root&lt;Pedido&gt; root = criteriaQuery.from(Pedido.class); /** * if the Cliente is a list you should use ListJoin instead of Join so it's ListJoin&lt;Pedido, Cliente&gt; *if you don't have metadata you can use root.join(root.get("id_cliente")). */ Join&lt;Pedido, Cliente&gt; cliente = root.join(Pedido_.id_cliente, JoinType.LEFT); Join&lt;Cliente, ClientePessoaFisica&gt; clientePessoaFisica = cliente.join(Cliente_.id, JoinType.LEFT);//or if you don't have metadata you can use root.join(cliente.get("id_cliente")) Join&lt;Pedido, FormaPagamento&gt; formaPagamento = root.join(Pedido_.id_forma_pagamento, JoinType.LEFT); //or if you don't have metadata you can use root.join(root.get("id_forma_pagamento")) Join&lt;Pedido, TipoPagamento&gt; tipoPagamento = root.join(Pedido_.id_tipo_pagamento, JoinType.LEFT);//or if you don't have metadata you can use root.join(root.get("id_tipo_pagamento")) Join&lt;Pedido, StatusPedido&gt; statusPedido = root.join(Pedido_.id_status_pedido, JoinType.LEFT);//or if you don't have metadata you can use root.join(root.get("id_status_pedido")) Join&lt;Pedido, Itempedido&gt; itempedido = root.join(Pedido_.id, JoinType.LEFT);//or if you don't have metadata you can use root.join(root.get("id")) Join&lt;Itempedido, Produto&gt; produto = itempedido.join(Itempedido_.id_produto, JoinType.LEFT);//or if you don't have metadata you can use root.join(itempedido.get("id_produto")) /** * Here you can select what ever you want, here's an example and you can complete it yourself :) * But I would remove this line and select the object itself Pedido * Now it depends on you FetchType of the relationships, you might need fetch join */ criteriaQuery.multiselect(root.get("id"), root.get("valor_total"), formaPagamento.get("descricao")); TypedQuery&lt;Pedido&gt; query = entityMan.createQuery(criteriaQuery); return query.getResultList(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload