Commit Graph

1790 Commits

Author SHA1 Message Date
Christoph Strobl
48e6f3189e Prepare next development iteration.
See #2531
2022-07-15 15:30:45 +02:00
Christoph Strobl
c4148e5bd5 Release version 3.0 M5 (2022.0.0).
See #2531
2022-07-15 15:18:29 +02:00
Christoph Strobl
c6db8a774a Prepare 3.0 M5 (2022.0.0).
See #2531
2022-07-15 15:17:55 +02:00
Christoph Strobl
3a33cbca27 Rename JpaRuntimeHintsRegistrar to JpaRuntimeHints.
See: #2497
2022-07-14 06:20:54 +02:00
Greg L. Turnquist
3d8b287e0e Properly handle null values inside queries using LIKE or CONTAINS.
Null values are wrapped with a special handler when interacting with Hibernate. However, this becomes an issue for queries when LIKE or CONTAINS are applied. In this situation, the null needs to be condensed into an empty string and any wildcards can then be applied with expected results.

Closes #2548, #2570.
Supercedes: #2585.
Related: #2461, #2544#
2022-07-13 17:00:01 -05:00
Greg L. Turnquist
eff294f569 Polishing. 2022-07-13 16:26:08 -05:00
Oliver Drotbohm
1fc9c2529b Set up entity load graph test according to what's required by Hibernate 6.
As recommended in [0], we now set up our integration tests verifying the application of entity load graphs using a lazy @ManyToOne relationship.

[0] https://hibernate.atlassian.net/browse/HHH-15391

Related to #2423.
2022-07-13 17:49:03 +02:00
John Blum
c51d32c0ff Adapt to repackaging of the AOT RuntimeHintsPredicate.
Closes #2592.
2022-07-12 17:48:55 -07:00
Christoph Strobl
7de1ffdf25 Guard auditing runtime hints.
See: #2497
2022-07-12 14:48:25 +02:00
Oliver Drotbohm
453f879af3 Upgrade to Hibernate and Hibernate Envers 6.
TypedQuery inspection through its String representations seems to be a bit flaky in Hibernate 6 still [0]. Tweaked the code to extract a query string from a query object to try the new way first but fall back to the old way, as this seems to work under some conditions, too. Adapted the test case in which we could rather inspect the new SqmQuery API for test result verification.

Re-bootstrapping the EntityManagerFactory for the same persistence unit causes the second bootstrap to fail als apparently foreign key names are randomized and the second bootstrap doesn't create a new constraint but tries to work with a new name. Tweaked the offending test case to reuse the existing EMF declaration as it actually only tests the qualified wiring into clients.

Applying an entity graph is causing a StackOverflow in current Hibernate 6. Filed an issue [1] and disabled the test case for now.

Dial back on the flip to use String as parameter type for like expression escape characters as Eclipselink rejects that. The JPA spec chapter 4.2.10 allows both Character and String to be used. Filed [2] with Hibernate to ask for reintroduction of the support for characters and commented out the test cases for now.

Deprecated CustomHsqlHibernateJpaVendorAdapter as it's not needed on Hibernate 6 anymore. Rewrote HibernateJpaParametersParameterAccessor to use Hibernate 6 API.

Add Hibernate 6 upgrade information to the reference docs.

Related ticket: #2423.

[0] https://hibernate.atlassian.net/browse/HHH-15389
[1] https://hibernate.atlassian.net/browse/HHH-15391
[2] https://hibernate.atlassian.net/browse/HHH-15392
2022-07-12 10:23:45 +02:00
Oliver Drotbohm
b3a18c020f Properly set up source result types from the start during query creation.
For count queries always start with Long instead of the domain type (Hibernate 6 rejects a mismatch between the type the query was originally set up for and the type to be actually selected).

For delete queries, do not use the type to be read, but the domain type as we load the individual instances first to make sure we properly fire entity callbacks.

Related ticket: #2423.
2022-07-12 10:23:45 +02:00
Greg L. Turnquist
9bce5dd9a4 Polishing. 2022-07-11 16:37:18 -05:00
Greg L. Turnquist
aa6a809c31 Introduce @Meta data support for repository methods.
Closes #775.
2022-07-11 16:07:38 -05:00
Christoph Strobl
36764e5f1a Simplify auditing setup.
Use IsNewAwareAuditingHandler factory method to avoid exposing additional beans.

See: #2497
2022-07-11 14:03:55 +02:00
Christoph Strobl
5821272112 Guard optional runtime hints.
This commit adds a guard to types that must not be present at AOT build time.

See: #2497
2022-07-11 14:03:55 +02:00
Vladislav Yukharin
9c757660d2 Fix grammar mistakes in countOccurrences method of QueryUtils class.
Original pull request #2572
2022-07-11 10:31:32 +02:00
Christoph Strobl
1bfc3595ce Add AOT repository support.
We now use the AOT infrastructure of Spring Framework 6 and data commons to provide AOT support building the foundation for native image compilation.
Additionally we register hints for GraalVM native image.
Also update jpa auditing configuration to avoid inner bean definitions.

See: #2497
Original Pull Request: #2588
2022-07-06 15:16:41 +02:00
Greg L. Turnquist
bc4347c507 Upgrade Hibernate to 5.6.9.Final.
Closes #2583.
2022-06-28 13:52:07 -05:00
Diego Krupitza
c4a6d382ed Adds support for more SelectBody types in JSqlParserQueryEhancer.
We now support `ValuesStatement` and `SetOperationList`. This allows native queries to use `union`, `except`, and `with` statements in native SQL queries.

Closes #2578.
2022-06-28 11:28:26 -05:00
Greg L. Turnquist
63919b5a7b Drop links to changelog.txt from README.
Closes #2569.
2022-06-15 13:50:11 -05:00
Greg L. Turnquist
cb6c74f89d Simplify accessing the ID of an entity.
Delegate ID access to the JPA provider.

Closes #1854.
2022-06-14 11:12:02 -05:00
Greg L. Turnquist
f2e7bddb5a Ensure that single-parameter DTOs work with JPQL queries.
Closes #1869.
2022-06-13 16:44:54 -05:00
John Blum
b57eb85a23 Remove punctuation in Exception messages.
Closes #2566.
2022-06-08 12:46:50 -07:00
Greg L. Turnquist
48790adebb Align Spring Data JPA annotations with Spring Framework annotations.
Remove @Inherited from Spring Data JPA annotations to align with Spring Framework ones.

Closes #803.
2022-06-08 10:23:30 -05:00
Greg L. Turnquist
cbfb0f7a1c Alter JSR-310 converters to use java.sql.Timestamp instead of java.util.Date.
Closes #2077.
2022-06-06 16:27:54 -05:00
Greg L. Turnquist
cc1eb9ce2b Polishing.
See #2555.
2022-06-03 14:48:24 -05:00
Diego Krupitza
a344a76959 Make JSqlParserQueryEnhancer work with updating statements.
This implementation of QueryEnhancer was originally designed for SELECT statements. This commit now handles DELETE and UPDATE operations by side-stepping any sorting or other changes.

Keep in mind that "enhancing" non selects does not have any effect on them (and the current default implementation `QueryUtils` does not care either aka it often just returns the same query, null or empty string).

Closes #2555
2022-06-03 14:48:18 -05:00
Mark Paluch
c2a305f01d Update CI properties.
See #2531
2022-06-03 09:34:19 +02:00
Mark Paluch
ddc36dd723 Upgrade to Maven Wrapper 3.8.5.
See #2560
2022-06-03 09:32:46 +02:00
Greg L. Turnquist
782bcf325d Fine tune checks for JDBC and JPA style parameters.
The checks for JDBC and JPA parameters were sloppy and based on side effects. By using zero width lookaheads, we can precisely spot situtations where the user has both types of parameters. Otherwise, let the query on through to the JPA provider.

Closes #2551.
2022-05-31 14:31:22 -05:00
Conor McGale
f8d85b6f14 Fixes broken link to 'Accessing JPA Data with REST' guide.
Original pull request #2550
2022-05-31 14:22:34 +02:00
Jens Schauder
4aeac55211 Polishing.
Added author tag, JavaDoc and improved test name.

See #2540
Original pull request #2542
2022-05-25 10:43:53 +02:00
Cedomir Igaly
718f9201fc Improve robustness of HibernateJpaParametersParameterAccessor.
This change avoids errors when no transactional EntityManager is available.

Closes #2540
Original pull request #2542
2022-05-25 10:43:52 +02:00
Greg L. Turnquist
0aa6d7d6e7 Apply query hints to count queries for page-based Specification.
Query hints are applied in many places, but not when doing a findAll(Specification, Pageable).

Closes #2054.
Original pull request #2528
2022-05-23 11:35:10 +02:00
Greg L. Turnquist
724538999a Make getPredicate return null when there are no predicates.
This does integration testing with both EclipseLink and Hibernate, verifying that queries are run properly. I also inspected the generated queries in the debugger, verifying the "where true=1" was no longer generated.

Closes #2282.
2022-05-20 16:49:54 -05:00
Greg L. Turnquist
f5ddb7aa32 Fix order by clauses for functions with positional and named arguments.
Related: #2045.

Closes #425.
2022-05-19 17:13:35 -05:00
Greg L. Turnquist
e3439f3440 Better parse 'order by' clauses to handle subqueries.
By properly parsing "order by" clauses, Spring Data JPA can apply sorting parameters to the end of queries in the event of complex queries that involve nested subselects.

Closes ##2496, #2522, #2537, #2045.
2022-05-19 15:15:50 -05:00
Greg L. Turnquist
2b6715a6e4 Polishing.
See #2502.
2022-05-18 17:47:54 -05:00
Greg L. Turnquist
9fc36ef82a Check for page offsets exceeding Integer.MAX_VALUE.
Instead of relying on the JPA provider to handle page offsets exceeding Integer.MAX_VALUE, do the check inside Spring Data JPA and provide a more meaningful error message.

Closes #2502.
2022-05-18 17:45:16 -05:00
Greg L. Turnquist
6be9b1460e JpaQueryLookupStrategy shouldn't use exceptions for flow control.
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.

Closes #2018.
2022-05-18 15:25:31 -05:00
Oliver Drotbohm
13ae7e586a Fix potential NullPointerException in ParameterMetadataProvider.
We now guard against null values returned from ParameterExpression.getJavaType() before inspecting the value further as it turns out that Class.isAssignableFrom(…) chokes on null values being passed.

Looks like Hibernate six returns null in scenarios it previously didn't.
2022-05-17 17:47:35 +02:00
John Blum
76412cce9c Remove Docker Registry login.
Closes #2533.
2022-05-16 11:35:36 -07:00
Christoph Strobl
fed7bf8036 Fix pom.xml formatting.
This commit reverts formatting changes introduced via 688bf63b86.

See #2471
2022-05-13 12:55:13 +02:00
Christoph Strobl
665a905e5d After release cleanups.
See #2471
2022-05-13 10:53:25 +02:00
Christoph Strobl
95201377d1 Prepare next development iteration.
See #2471
2022-05-13 10:53:23 +02:00
Christoph Strobl
5b4a4d9490 Release version 3.0 M4 (2022.0.0).
See #2471
2022-05-13 10:43:58 +02:00
Christoph Strobl
688bf63b86 Prepare 3.0 M4 (2022.0.0).
See #2471
2022-05-13 10:43:19 +02:00
Greg L. Turnquist
481d1b0a0d Verify custom finders can handle PageRequest as method parameter.
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.
2022-05-12 14:38:18 -05:00
evgeny.bovykin
7cb16de9e1 Fix debug logging in MergingPersistenceUnitManager.
A String.format token was missing, so `mappingFileName` was printed instead of a `persistenceUnitName`, and `persistenceUnitName` wasn't actually printed at all.

See #2526.
2022-05-10 16:50:21 -05:00
Greg L. Turnquist
8ea70c1e42 Remove duplicate 'distinct' applied in count operations.
When performing a count operation, we are using countDistinct from JPA, and hence, don't need the JpaQueryCreator applying distinct outside the whole thing.

Also added some details in the ref docs to help guide users on writing proper distinct-based queries.

See #1380.
2022-05-09 09:57:46 -05:00