Skip to content

introduce StatementOrTypedQuery and withResultSetMapping()#920

Merged
gavinking merged 6 commits intojakartaee:mainfrom
gavinking:queryorstatement
Feb 26, 2026
Merged

introduce StatementOrTypedQuery and withResultSetMapping()#920
gavinking merged 6 commits intojakartaee:mainfrom
gavinking:queryorstatement

Conversation

@gavinking
Copy link
Copy Markdown
Member

fixes #919

@gavinking gavinking marked this pull request as ready for review January 21, 2026 08:23
@gavinking gavinking added 4.0.0 candidate-for-4 Good candidate for JPA 4 and removed 4.0.0 labels Jan 21, 2026
@gavinking gavinking force-pushed the queryorstatement branch 2 times, most recently from 6aea0e7 to 3154c19 Compare January 21, 2026 09:19
@gavinking
Copy link
Copy Markdown
Member Author

I've also removed the EntityGraph mutator from TypedQuery, as requested by @sebersole, so that the graph for a TypedQuery is now immutable, and the query itself has a fixed interpretation upfront.

@gavinking gavinking changed the title introduce QueryOrStatement and withResultSetMapping() introduce StatementOrTypedQuery and withResultSetMapping() Jan 22, 2026
Copy link
Copy Markdown
Contributor

@sebersole sebersole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested a minor improvement. Might add similar @see tags to Statement as well.

* {@link EntityManager#find(EntityGraph, Object, FindOption...)},
* {@link EntityManager#get(EntityGraph, Object, FindOption...)},
* or {@link TypedQuery#setEntityGraph(EntityGraph)} is
* {@link EntityHandler#createQuery(String, EntityGraph)}, or
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Comment thread api/src/main/java/jakarta/persistence/TypedQuery.java
gavinking and others added 6 commits February 26, 2026 20:02
as requested by @sebersole - with the purpose of making
the interpretation of the query fixed after construction
of the TypedQuery, which is good for performance (we now
have other ways to specify an EntityGraph for a query)
after reflection + discussions with @sebersole
Co-authored-by: Steve Ebersole <steve@hibernate.org>
@gavinking
Copy link
Copy Markdown
Member Author

Thanks, @sebersole, I've committed your suggestion, and now I'm going to merge this one.

@gavinking gavinking added 4.0.0 and removed candidate-for-4 Good candidate for JPA 4 PRIORITY labels Feb 26, 2026
@gavinking gavinking merged commit 8408c97 into jakartaee:main Feb 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StatementOrTypedQuery

2 participants