Bonjour à tous, je suis en train de développer une application de CRUD avec JPA hybernate. J'ai une erreur sur une de mes requête en particulier.
1ere question comment peut on tester les requêtes jpql ?
2eme question, voila la requête qui pose probleme. Si jamais quelqu'un voit l'erreur je suis preneur.
Pour préciser, l'entity PointDePassage possede un objet Position. La table PointDePassage possède un champ position_id pour relier les 2 entitys.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 public PointDePassage getByPosition(Long idPosition) throws Exception { Query query = em.createQuery("SELECT pdp FROM PointDePassage pdp WHERE pdp.position_id LIKE :"+idPosition); //query.setParameter("position_id", "%" + idPosition + "%"); PointDePassage pdp = (PointDePassage) query.getSingleResult(); return pdp; }
J'utilise netbeans 6.5.
Partager