java - JPA use IN clause with objects -


i facing problem usign jpa, , more using in clause.

the best way is, think, show code :

@namedquery(name = "commande.findcustom", query = "select distinct [myfields] "             + "from commande c "             + "[somecriterias] , "             + "c.id in (select t.id subtable t "             + "where t.idx in :param) , [othercriterias]"), 

i error mysql :

you have error in sql syntax; check manual corresponds mysql server version right syntax use near '.id subtable t1 (t1.idx in (168)' 

i looking response can't find ...

i tied delete in clause, problem still same (so it's not double in use problem)

my :param list of objects, got using object.find() method. can see, returns id (168). can't seem find problem ...

any appreciated, thank you

edit : full query

@namedquery(name = "commande.findcustom", query = "select distinct c.idchargement, c.libelle, "             + "c.codetransporteur, c.reference, c.datecreation, c.datechargementprevu, "             + "c.datevalidationchargement, c.datelivraisonprevue, c.codedestinataire, "             + "c.raisonsocialedestinataire, c.adressedestinataire, c.codepostaldestinataire, "             + "c.villedestinataire, c.paysdestinataire, c.contactdestinataire, "             + "c.telephonedestinataire, c.maildestinataire, c.poidscommande, c.nombrecolis, "             + "c.nombreunitemanutention, c.typeunitemanutention, c.prendrerdv, c.commentaires "             + "from commande c "             + "c.idchargement = :idchargement , c.codetransporteur = :codetransporteur , "             + "(c.datecreation between :datedebut , :datefin) , "             + "c.iddernierstatut in (select l.idlistestatutscommande listestatutscommande l "             + "where l.idstatut in :idstatut) , c.raisonsocialedestinataire = :raisonsociale , "             + "c.adressedestinataire = :adressedestinataire , c.codedestinataire = :codedestinataire "             + "and c.codepostaldestinataire = :codepostal , c.villedestinataire = :villedestinataire "             + "and c.paysdestinataire = :codepays") 

and error message

you have error in sql syntax; check manual corresponds mysql server version right syntax use near '.idlistestatutscommande listestatutscommande t1 (t1.idstatut in (168)' 

as getting error mysql not hibernate, try find out query generated. this, use proxy invoker p6spy , should clear. check p6spy site. when do, try invoke such generated sql , try fix it. used such method when had troubles using jpa's joins fetches , stuff. helpfull in diagnosing such problems.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -