using Entitymanager to return a List

Asked

Viewed 463 times

0

Guys, I’m having a problem at the bank looking for a list of phones, these phones have to belong to a number.

in my query I do this

public List<Telefone> buscar(Proprietario proprietario) {
      return this.manager.createQuery("select e from Telefone e where 
       e.cpfProprietario = :cpfProprietario").setParameter("cpfProprietario", proprietario.getCpfProprietario()).getResultList();
}

Where am I going wrong?

The Telephone entity has a relationship with owner.

If you need more information, feel free to contact us at github

1 answer

0


With JPQL the Query are made in the OO style, its error is put and.cpfProprietary being that the Telephone class does not have a property called cpfProprietary but rather a proprietary that contains cpfProprietary. What might be confusing you and that phone table has a cpfProprietary column.

public List<Telefone> buscar(Proprietario proprietario) {
      return this.manager.createQuery("select e from Telefone e where 
       e.proprietario.cpfProprietario = :cpfProprietario").setParameter("cpfProprietario", proprietario.getCpfProprietario()).getResultList();
}
  • truth, I ended up hooking up with this hehe

Browser other questions tagged

You are not signed in. Login or sign up in order to post.