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

TCK tests for literals in query language #592

Merged

Conversation

njr-11
Copy link
Contributor

@njr-11 njr-11 commented Mar 25, 2024

Add TCK tests for literals defined by the Jakarta Data Query Language.

While testing this, I noticed that we did not comply with Jakarta Persistence 3.2 M2 specification regarding how enum literals and so I fixed that as well.

@njr-11 njr-11 added the test Something test-related label Mar 25, 2024
@njr-11 njr-11 added this to the Jakarta Data 1.0 milestone Mar 25, 2024
@gavinking
Copy link
Contributor

While testing this, I noticed that we did not comply with Jakarta Persistence 3.2 M2 specification regarding how enum literals and so I fixed that as well.

Ah, nice catch, I missed that (Hibernate does not require the class name).

@gavinking
Copy link
Contributor

Then the grammar needs to change too:

enum_literal : IDENTIFIER ('.' IDENTIFIER)*;

@njr-11
Copy link
Contributor Author

njr-11 commented Mar 25, 2024

Then the grammar needs to change too:

enum_literal : IDENTIFIER ('.' IDENTIFIER)*;

Thanks for pointing that out. I added it to this commit.

@@ -70,11 +71,17 @@ Stream<AsciiCharacter> findByHexadecimalIgnoreCaseBetweenAndHexadecimalNotIn(Str

Optional<AsciiCharacter> findFirstByHexadecimalStartsWithAndIsControlOrderByIdAsc(String firstHexDigit, boolean isControlChar);

@Query("WHERE hexadecimal <> ' ORDER BY isn''t a keyword when inside a literal' AND hexadecimal IN ('4a', '4b', '4c', ?1)")
Copy link
Contributor

Choose a reason for hiding this comment

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

If it is verified at build time, it might not compile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it is verified at build time, it might not compile.

Can you explain why and where the error is? As best I can see, the query language used is consistent with what is defined in the spec here. A user can write this query and they will expect it to work, per the spec.

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind.

Remember that JPA Buddy does this validation at the build time and while you are coding; however, this is not a JPA provider but a plugin.

@otaviojava otaviojava merged commit 9b89056 into jakartaee:main Mar 26, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Something test-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants