In the case of @NamedNativeQuery, it might even be useful to add a way to specify the tables or entities affected by a native query, to allow auto-flush to work correctly:
public @interface NamedNativeQuery {
...
FlushModeType flushMode() default AUTO;
CacheStoreMode cacheStoreMode() default USE;
CacheRetrieveMode cacheRetrieveMode() default USE;
int timeout() default -1;
// control over auto-flush
String[] affectedTables() default {};
Class<?>[] affectedEntities() default {};
}
Currently, a
@NamedQuery
or@NamedNativeQuery
may specify query hints using the verbose and stringly-typed annotation@QueryHint
.I propose making certain "hints" available in a typesafe way, for example:
In the case of
@NamedNativeQuery
, it might even be useful to add a way to specify the tables or entities affected by a native query, to allow auto-flush to work correctly: