Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPQL: SELECT and CONCAT

 
Oliver Baum
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic