-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Implement EQL query parser #3176
Conversation
Implement support for EclipseLink Query Language (EQL), handling the various extensions it offers. See #3170
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a first review pass. Impressive work, also on the verification side. I left a few comments to be addressed.
@@ -0,0 +1,132 @@ | |||
/* | |||
* Copyright 2022-2023 the original author or authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Year of inception is the current year across all newly introduced files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* @param query must not be {@literal null}. | ||
* @return a new {@link JpaQueryEnhancer} using EQL. | ||
*/ | ||
public static JpaQueryEnhancer forEql(DeclaredQuery query) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Missing @since
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -37,6 +37,9 @@ public final class QueryEnhancerFactory { | |||
private static final boolean hibernatePresent = ClassUtils.isPresent("org.hibernate.query.TypedParameterValue", | |||
QueryEnhancerFactory.class.getClassLoader()); | |||
|
|||
private static final boolean eclipseLinkPresent = ClassUtils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not use org.eclipse.persistence.jpa.JpaEntityManager
? Generally, why do we not introduce a property on PersistenceProvider
to check whether it is available on the class path?
Introducing redundant checks results in code that is difficult to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I crafted a solution to essentially check for the presence of the same class names used to construct the instances of PersistenceProvider
. I also created an interface, PresenceDetector
, which I'm not 100% certain we need. Feel free to drop that. It should be visible below.
* IMPORTANT: Purely verifies the parser without any transformations. | ||
* | ||
* @author Greg Turnquist | ||
* @since 3.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not maintain @since
tags for tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
@Test | ||
void theRest() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theRest<n>
isn't a good naming in particular because it doesn't provide any information. Any chance we can find a better naming that at least gives hints what we're up to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied that over from JPQL tests. It was a bit of a shortcut. I'll fix it.
} | ||
|
||
@Test | ||
void theRest() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See theRest
comments in one of the previous files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
Fix dates and names of theRest methods.
Fix "the rest" of the theRest method names.
…ovider. I created an interface to define the isPresent operation. I don't know whether or not we really need a separate interfacce. Remove it if needed. The lookup is used directly, so perhaps there is little gained by that.
Simplify PersistenceProvider by removing PresenceDetector interface. Refine presence detection to make present field final. Add warning suppressions as we know that we duplicate code (similar code) and that ANTLR doesn't generate methods with nullable annotations. See #3170 Original pull request: #3176
That's merged and polished now. |
No description provided.