jakartaee / jakartaee/persistence

Add support to retrieve JPQL query from Query object

Open
#25 9 comments 2 reactions 0 assignees View on GitHub
JPA_next jpql Priority: Major query Type: New Feature
Dominant language
Java
Stars
268
Forks
78
Avg merge
1d 6h
Merged PRs (30d)
13

Description

Currently the interfaces javax.persistence.criteria.AbstractQuery and javax.persistence.Query have no support for retrieving the underlying JPQL Query for additional transformation which would be, especially for named queries, very useful! Just think of the fact, that you currently have to copy and paste a named query if you like to have exactly the same query with an additional predicate in the where clause. The predicate in the where clause is just an example, there are probably tons of use cases where this feature would be helpful and minimize redundant code!

I would suggest to add the following methods:

```
**Query.java**public interface Query{
// currently available methods...
public String getQuery();
}
```
```
**AbstractQuery.java**public interface AbstractQuery{
// currently available methods...
public String getQuery();
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reading the javax.persistence.Query and javax.persistence.criteria.AbstractQuery interface definitions and the existing issue discussion. Determine the API and specification implications of exposing the underlying JPQL, including how the proposed getQuery() method would be defined. Done means the proposal has an agreed scope and corresponding specification changes and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.