Get the last occurence of a list attribut

#1

Hello everyone, 

I'm working on a project where I have a object 'RO' that has a list of "PULabel". The type of my PULabel in my database is a "SLabel". The object RO has other "SLabel".

I'm working on a query that return all the last "PULabel" of every RO object.

I have written someting like this :

SELECT s 
FROM ReturnOrder r
JOIN (SELECT s FROM r.pickUpLabel LIMIT 1)

ORDER BY s.persistenceId ASC

But it's look like it's not a correct query, the compiler does not like the parentheses "(" and the "LIMIT". Is it possible de make a sub request in a JPQL query ?

#2

Subqueries are currently not supported. The workaround in this case (which could also provide much better performance than subqueries) is to maintain a reference to the last label directly in every RO object.

ObjectDB Support

Reply