I have a Detectable
class with a Revisions
set, which are Hibernate managed POJOs. I\'m also mapping my entities using hbm.xml files. Wh
I finally achieved it with this code:
<property name="_LastRevisionDate"
formula="(select MAX(rev.start_date) from trevision rev where rev.id_detectable = id_detectable and rev.status != 'DRAFT')"
type="date" />
Where id_detectable
is my current entity key column.
UPDATE
Another workaround is to use a DB view to obtain the last revision date. Then, there's the choice to map the Entity against that view instead of the original table.
What is the sql syntax error? Did you try replacing _Id
with id
?