This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes JPQL: SELECT and CONCAT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JPQL: SELECT and CONCAT" Watch "JPQL: SELECT and CONCAT" New topic
Author

JPQL: SELECT and CONCAT

Oliver Baum
Greenhorn

Joined: Jan 12, 2005
Posts: 16
Hi,
hope somebody can help me.
I want to use a query with JPA 2.0. But it dosn't work and I don't know why.

The query:
select distinct v from Partnersuche v where v.partnerIndex in (SELECT concat(p.pk.nebenPartnerNr, max(p.pk.paLfdAdressNr)) from PartnersucheV p where p.psPartnerartKey = 1 group by p.pk.nebenPartnerNr)

and here the error:
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [select distinct v from Partnersuche v where v.partnerIndex in (SELECT concat(p.pk.nebenPartnerNr, max(p.pk.paLfdAdressNr)) from PartnersucheV p where p.psPartnerartKey = 1 group by p.pk.nebenPartnerNr)], line 1, column 71: unexpected token [concat].
Internal Exception: NoViableAltException(16@[1292:16: ( DISTINCT )?])


When I use Hibernate it works.

Thanks for help
Oliver
 
Consider Paul's rocket mass heater.
 
subject: JPQL: SELECT and CONCAT