is it possible to use PostgreSQL-like DISTINCT ON in EJB using named query?
o.fromDate,o.empLeaveMasterId,o.employeeInfoId, o.leavePurposeId ,o.toDate,o.createdByUserId,o.createDate,o.lastModifiedUserId,o.lastModifiedDate,o.isSystemRecord
The field describe above is my entity bean field and I want to get fromDate wise distinct record
Is it possible using namedquery ?
I don’t see how this could be possible: JPQL offers a language that can be translated into SQL for any database, this obviously excludes database specific keywords.
My suggestion would be to use
GROUP BYand subqueries instead, as suggested in the PostgreSQL documentation:Or use a native query if portability is not a concern.