Blessed Geek
Blessed Geek

Reputation: 21614

JPQL function encapsulating an aliased field

I had no problems with the following in Hibernate JPA

SELECT e
FROM Employee e
INNER JOIN FETCH e.address AS a
WHERE a.state = :state
 AND e.middle = :middle
 AND trunc(a.birthdate) > :mindate

However, eclipselink croaks syntax error on

trunc(a.birthdate) > :mindate

How do I encapsulate an alias-referenced field with an SQL function in eclipselink?

Upvotes: 1

Views: 1237

Answers (1)

MattR
MattR

Reputation: 7048

The problem isn't the alias reference but the trunc() function - trunc is SQL not JPQL.

The answer to this question might help you: SQL for NamedQuery in EclipseLink

Upvotes: 1

Related Questions