Skip to content

Suggested fix for #2540 #2541

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

Closed
wants to merge 66 commits into from
Closed

Suggested fix for #2540 #2541

wants to merge 66 commits into from

Conversation

cigaly
Copy link
Contributor

@cigaly cigaly commented May 23, 2022

odrotbohm and others added 30 commits January 25, 2022 09:15
With the commit for GH-2363, we introduced an unguarded call to ReturnedType.getTypeToRead(), which could return null under certain conditions. Unfortunately Spring Data JPA dod not contain a test case that triggered that scenario.

This commit switches to ReturnedType.getReturnedType() which is non-nullable and lets us inspect the calls results for interfaces, which we need to create the JPA query properly.

Fixes GH-2408
Indentation in testcases (spaces -> tabs). Additional imports.
The error message for nonexistent properties inside query derivation now wraps the named property with single quotes. This breaks a test case that was looking for spaces before and after.

Closes #2418.
…rsions > 5.4.21.

Hibernate 5.4.22 started including types managed by custom user types in the embeddables exposed via JPA's Metamodel API. This causes those to be considered types to explicitly map (read: unfold) in Spring Data REST. We now exposed a cleaned up view on this via a tweak in JpaPersistentPropertyImpl (ultimately in JpaMetamodel) looking for @embeddable annotation on types allegedly considered embeddable by Hibernate.

Fixes #2421.
Extract docker credentials into properties file.

See #2413
Extract artifactory credentials into properties file.

See #2413
Replaced in `AbstractJpaQuery` the deprecated way of using `Lazy` with the suggested `Lazy.of(...)`.

Original pull request #2429
The Auditable interface introduces Optional getters, which when combined with Query by Example results in cryptic errors. By ignoring a probe's field that contains an Optional.empty, Query by Example works properly.

NOTE: This fix actually tests outside the originally detected scope of Auditable, verifying that ALL Optional.empty() fields are properly handled.

Closes #2176
Original pull request #2401
Removed Given/When/Then comments.
They are of limited use, especially since it is debatable what belongs in which section.

See #2176
Original pull request #2401
Original pull request #2432

All fields of an interface are by default `public static final`. To make the code more readable the redundancy is removed.
There were few explicit `toString()` calls that are not needed, since `toString()` will be called by default.

Original pull request #2431
Convert ID's to entities and pass them to deleteAllInBatch.

Closes #2414
Original pull request #2419
Formatting.
Fix warnings.

See #2414
Original pull request #2419
A lot of jUnit tests had in the method header a `throws` that is useless. For example `throws Exception` on a method where no exception is thrown. Removing this noice will make the tests more redable.

Original pull request #2433
…tBy and FetchableFluentQueryByPredicate.sortBy

Closes #2438
Original pull request #2439
See #2438
Original pull request #2439
It is now possible to make existence checks based on a `Specification`. This is an addition to checking existence with using an `Example`.

Closes #2388
Original pull request #2449
Fixed import formatting.
Removed (non-Javadoc) comment, since we don't use them anymore.
Simplified some code and removed superfluous or wrong Javadoc in touched files.
Formatting.

See #2388
Original pull request #2449
Introduce a library that makes it possible to parse native SQL statements.

See #2409.
gregturn and others added 26 commits March 23, 2022 09:25
The `COUNT_MATCH` does not consider line breaks after the `from` clause or the `where` clause. This leads to a no match scenario in the construction of the count query. With the fix we now consider line breaks/whitespaces after the `from` and `where` clause.

See #2341
Related tickets: #2177
In several ways, it's possible to have various ORDER BY clauses, including SQL OVER (windowing) clauses. Need to improve handling of ORDER BY.

See #2260.
JpaRepository accepts Iterable<ID> for bulk deletes. But some JPA providers require Collection<ID> instead. To avoid breaking any APIs, convert the incoming argument if it's not already a Collection.

See #2242.
In commit 3e64d9a a bug got introduced that uses the next symbol after the table name for the count function. With this commit this should be now resolved. The count query will use `*` when there is no alias present nor a variable.

Related tickets #2341, #2177, #2260, #2511
In order to correctly identify aliases in the order by clause, we cannot process the from clauses left-to-right using regular expressions. These must be removed inner-to-outer. Commit c93aa25 resulted in a bug where the subquery would be incorrectly identified as the alias, as by the following query:

```
from Parent p join p.children c where not c.id not in (select c2.id from Child c2)
```

Passing in a Sort.by("name") would result in "order by c2.name" instead of "order by p.name". Thus, it was using the alias of the inner query instead of the outer query. [This comment](#2260 (comment)) suggests removing the content of the inner query, with the caveat of the entire query being surrounded by parenthesis. This commit does exactly that, by removing the subquery before the alias is identified. It also handles the case when the entire query is surrounded by parenthesis. Unit tests illustrate this along with several examples of removing the subquery to correctly identify the alias for the order by clause.

See #2260 (c93aa25), #2500, #2518.
Add a zero-width word boundary to the regex that identifies the from clause. This is used in alias detection.

See #2508, #2260.
A String.format token was missing, so `mappingFileName` was printed instead of a `persistenceUnitName`, and `persistenceUnitName` wasn't actually printed at all.

See #2526.
Spring Data Commons patched handling subclasses of special parameter types through spring-projects/spring-data-commons#2626. This commit adds test cases ensuring things work properly with Spring Data JPA.

See #2013.
By using exceptions for flow control, other critical exceptions are getting masked. The lack of a resolvable query should instead leverage some sort of null value object.

See #2018.
@cigaly cigaly changed the title 2.7.x Suggested fix for #2540 May 23, 2022
@cigaly cigaly closed this May 23, 2022
@cigaly cigaly deleted the 2.7.x branch May 23, 2022 10:00
@cigaly cigaly restored the 2.7.x branch May 24, 2022 20:35
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.