-
Notifications
You must be signed in to change notification settings - Fork 68
Description
We currently don't have a very clean or well-defined split between TypedQuery, which I claim should always represent a select query, and update/delete queries, which I claim should always be executed via the untyped supertype Query.
This sorta reflects the fact that TypedQuery was hacked on later in JPA 2.0.
In fact, it's quite arguable that Persistence 3.2 lets you execute a named update query using TypedQuery<Void> obtained via a TypedQueryReference. I don't recall if we really intended that, but even if we did, I don't think it's great.
As a first step to cleaning this up I would:
- override and deprecate
executeUpdate()onTypedQuery - introduce the (unparameterized) type
QueryReferenceto represent untyped queries
A further optional step might be to introduce a dedicated interface for executing update/delete queries (the equivalent of Hibernate's MutationQuery) which subtracts all the operations of Query which are only relevant to select queries. I'm not sure of the best way to do this, and I'm concerned about introducing an explosion of createQuery() operations, so perhaps it's not worth going this far.