Remko Strating wrote:
An alternative is defining the named query within the orm.xml. I believe this would be my final place, because it makes controlling and adjusting easier without adjusting your source code.
I agree that a mapping file is a good place for such kinds of named queries: There the named query can be defined on top-level, independently of any entity class: