Repository navigation
Split JakartaStatement from JakartaQuery, &c. - #1229
Conversation
yrodiere
left a comment
There was a problem hiding this comment.
The proposal itself, independently from downstream usage, makes sense.
But damn, it's an inconvenient time for this.
If this goes through:
- Sooner is better than later. I won't go into details, but breaking this before the end of January would be much more manageable on the Quarkus side, and for Hibernate ORM who's taken some stability commitments.
- Do you think we could preserve the "lenient" behavior (perhaps with warnings) of allowing INSERT/UPDATE/DELETE in
@NativeQuery/@JakartaQueryon the implementation side with a feature flag? I'm asking the hibernate-processor contributor about complexity, not the spec lead about whether it's allowed, since I know implementations can do whatever they want with feature flags.
| * {@code jakarta.data.repository.Query} as a synonym for this annotation | ||
| * when it specifies an {@code UPDATE} or {@code DELETE} statement. |
There was a problem hiding this comment.
Jakarta Query (JPQL) has no INSERT. See jakartaee/query#123.
There was a problem hiding this comment.
Okay. I guess the fate of INSERT in this case is implementation-dependent then.
There was a problem hiding this comment.
Well, everything to do with INSERT is implementation dependent because it's a Hibernate-only feature ... so ... yeah.
We can certainly preserve it in Hibernate. |
| * backed by Jakarta Persistence. | ||
| * </ul> | ||
| * <p> The return type of the method must be {@code void}, {@code int}, | ||
| * or {@code long}. The parameter types of the method must agree with the |
There was a problem hiding this comment.
Statement's execute returns int so we allow for long just to "store" those int values, right ?
There was a problem hiding this comment.
Jakarta Data allows long here. Just in case you're updating more than 2 billion rows in one statement :-)
good catch by @marko-bekhta
|
Unfortunate for certain reasons, but not against it. |
njr-11
left a comment
There was a problem hiding this comment.
This looks good and I think the separate between QueryOptions and StatementOptions worked out nicely as well. I added two minor and optional suggestion comments.
If Jakarta Persistence providers are allowed to handle UPDATE/DELETE via |
Co-authored-by: Nathan Rauh <nathan.rauh@us.ibm.com>
He's just concerned about Quarkus. |
Yeah I'm talking about a temporary, implementation-specific, opt-in flag to preserve backwards compatibility in Quarkus. Obviously it'd have to be removed rather quickly. |
|
OK, so I have not heard any objection to this, and I see that @njr-11 just opened a PR to align Jakarta Data with this work. So bombs away. |
In #1220, @njr-11 asked for the ability to distinguish queries from statements in the "static" query annotations. Here's how we can do that in a way that's consistent with the other APIs. This adds some complexity which I had been hoping to avoid (three new annotations!) but it really is much more consistent and arguably somewhat more understandable.
I had hoped to not have to introduce changes like this so late in the game but here we are. It's better we find out about this stuff now.