jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
186 stars 55 forks source link

'id()' function #594

Closed gavinking closed 3 months ago

gavinking commented 3 months ago

For a very long time, the query language in Hibernate has allowed you to refer to the identifier of an entity via the syntax id(foo), and the version using version(foo). It was never clear that this was especially useful for anything, so I've never proposed it here.

However, it turns out that id() is really useful for defining generic repository interfaces in Jakarta Data, and we have really been going in circles and inventing quite nasty workarounds due to its absence in JPQL. And I think that version() will be useful for similar reasons.

I propose that we add the id() and version() functions to JPQL.

gavinking commented 3 months ago

Fantastic! Thanks @lukasj!