-
I have a question about using blaze-persistence and ensuring the validity of queries, specifically in comparison to the JPA Named Queries. In JPA, Named Queries are validated at server startup. If there are any invalid ones, the server won't start, allowing us to catch and rectify any issues immediately. When using blaze-persistence, however, it appears that entity fields and joins are specified as strings. This makes me wonder: Is there any mechanism to ensure these fields and joins are valid and existing at some point, similar to how it's done for Named Queries in JPA? For instance, when using Is there a similar feature or method in blaze-persistence that allows us to check and validate entity fields and joins at compile-time or startup-time, ensuring that all queries remain valid and up-to-date with entity changes? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The Hibernate JPA Metamodel generator generates static metamodel classes that also contain string constants for every entity field, so you could use that to ensure you are referring to the correctly named field. i.e. cb.where(MyEntity_.ID).eq(id) |
Beta Was this translation helpful? Give feedback.
There is an open issue for generating a custom static metamodel which you can watch if you want: #132