wood burning stoves 2.0*
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPQL: SELECT and CONCAT