Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] PrintInnerJoinInWhereClause as query hint #1671

Conversation

rfelcman
Copy link
Contributor

@rfelcman rfelcman commented Aug 24, 2022

This change extend usage of PrintInnerJoinInWhereClause from current persistence unit property into query hint like

@NamedQuery(
    name="QueryOrder.findAllOrdersWithEmptyOrderLinesHintFalse",
    query="SELECT o FROM QueryOrder o WHERE o.queryOrderLines IS EMPTY",
    hints={@QueryHint(name=QueryHints.PRINT_INNER_JOIN_IN_WHERE_CLAUSE, value="false")})

or

String jpql = "SELECT o FROM QueryOrder o WHERE o.queryOrderLines IS EMPTY";
Query query = em.createQuery(jpql, QueryOrder.class);
query.setHint(QueryHints.PRINT_INNER_JOIN_IN_WHERE_CLAUSE, "false");

It allows developers more preciously target (optimize) this property to the selected queries.
Fixes #1522.

…e in various normalize methods

Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
…e in various normalize methods

Unit test

Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
* This query hint should override global/session switch {@link org.eclipse.persistence.internal.databaseaccess.DatabasePlatform#setPrintInnerJoinInWhereClause(boolean)}
* @see org.eclipse.persistence.internal.databaseaccess.DatabasePlatform#setPrintInnerJoinInWhereClause(boolean)
*/
public static final String PRINT_INNER_JOIN_IN_WHERE_CLAUSE = "eclipselink.print-inner-join-in-where-clause";
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to make the constant name/value shorter, ie avoid the print word?

Copy link
Member

@lukasj lukasj left a comment

Choose a reason for hiding this comment

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

LGTM, just consider make the constant name/value shorter (iff makes sense...)

Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
@rfelcman rfelcman merged commit 1c799cd into eclipse-ee4j:master Aug 30, 2022
@rfelcman rfelcman deleted the bug_jpa_33820823_JPQLSetPrintInnerJoinWhereClause branch August 30, 2022 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL generation of JPQL IS EMPTY with printInnerJoinInWhereClause=false
2 participants