Error in NamedQuery

1

Good evening guys, I'm trying to create a namedquery with a query in the database. Following:

@NamedQuery(name="ListagemProdutosMesa",query="select Produto p FROM Produto p, Pedido pe, Conta c, Pedido_produto pp  where pe.id = pp.pedido_id and pp.produto_id = p.id and c.id = pe.conta_id and c.id=:idConta")

Where this table Pedido_produto is the table created just to reference the foreign keys (I think the problem is there).

The funny thing is that this query good wheel right in Postgres and Java is giving error. Could someone help me ???

    
asked by anonymous 13.05.2015 / 03:58

1 answer

1

I've solved it yet! As I was mapping in Java I was not thinking like objects, it follows query :

@NamedQuery(name="ListagemPedidoMesa",query="select pe.produto from Pedido pe, Conta c where c.id = pe.conta.id and c.numeroMesa =:nMesa and c.situacao = false") 
    
01.10.2015 / 01:45