I'm going to write this query, it works in Console.sql or in Workbench, but when I use it in @Query I get an error of syntax!
unexpected token: LIMIT
@Query("select w.name ,
(select d.name
from document d
where w.id = d.workspace.id
order by (d.id) DESC
LIMIT 1
) as nameLastDoc
from Workspace w
left join UserWorkspace u on u.workspace.id = w.id
left join Document d on w.id = d.workspace.id
group by (w.id)")
List<?> findAllWorkspaces();
In my IDE the error is in the next select
select w.name ,(select d.name ...