Commit Graph

615 Commits

Author SHA1 Message Date
Juergen Hoeller f22a1eece4 Polishing 2024-02-28 19:14:37 +01:00
Sébastien Deleuze 9430b24eaf Adapt Hibernate native support for HHH-17643
This commit adapts Hibernate native support to handle
the changes performed as part of HHH-17643 which impacts
Hibernate versions 6.4.3+ and 6.2.21+.

It ignores the BytecodeProvider services loaded by the
service loader feature in order to default to the
"no-op" provider with native, and makes the substitutions
more lenient when a substituted field or method does not
exist.

gh-32314 is expected to remove the need for such
substitutions which are not great for maintainability
by design.

Closes gh-32311
2024-02-22 16:30:32 +01:00
Stéphane Nicoll b55a4d3908 Prevent AOT from failing with spring-orm without JPA
This commit improves PersistenceManagedTypesBeanRegistrationAotProcessor
so that it does not attempt to load JPA classes when checking for the
presence of a PersistenceManagedTypes bean. To make it more clear a
check on the presence for JPA has been added to prevent the nested
classes to be loaded regardless of the presence of the bean.

Closes gh-32155
2024-01-30 15:43:07 +01:00
Juergen Hoeller 00bda65848 Polishing 2024-01-19 17:09:58 +01:00
Stéphane Nicoll 472dcdb59c Allow JPA entities to be filtered
This commit provides more control over JPA entities scanning by allowing
the result to be filtered.

Closes gh-27892
2024-01-19 15:38:53 +01:00
Stéphane Nicoll 0c42965fc3 Polish 2024-01-15 11:17:19 +01:00
Stéphane Nicoll 1f2d29ee08 Polish 2024-01-08 17:12:33 +01:00
Stéphane Nicoll 2d3b02a89d Polish 2024-01-08 11:48:08 +01:00
Stéphane Nicoll 9f3fd103ef Polish 2023-12-30 11:17:49 +01:00
Stéphane Nicoll 699f93fed7 Use proper SQLServer dialect for Hibernate 6+
This commit fixes the Hibernate dialect lookup for SQLServer as it was
previously using a dialect that has been deprecated. In recent
versions, the standard SQLServerDialect is the one we should be using.

Closes gh-31896
2023-12-26 14:03:20 +01:00
Stéphane Nicoll 0390709577 Use proper Oracle dialect for Hibernate 6+
This commit fixes the Hibernate dialect lookup for Oracle as it was
previously using a dialect that has been moved and deprecated to a
separate project. In recent versions, the standard OracleDialect is the
one we should be using.

Closes gh-31892
2023-12-22 15:22:01 +01:00
Stéphane Nicoll 9f2970bc5c Use non deprecated MySQL dialect for Hibernate 6+
This commit fixes the Hibernate dialect lookup for MySQL as it was
previously using a deprecated dialect that has been removed in the most
recent Hibernate version.

Closes gh-31889
2023-12-22 15:03:40 +01:00
Sébastien Deleuze 43c2e51d6e Document BytecodeProviderImpl substitution related issue
See gh-29549
See gh-31051
2023-12-14 15:37:43 +01:00
Juergen Hoeller 361dfd1ae4 Polishing 2023-12-09 23:51:18 +01:00
Juergen Hoeller c57b7e8418 Introduce ClassFormatException and spring.classformat.ignore property
Closes gh-27691
2023-12-09 20:03:57 +01:00
Brian Clozel 61dd9fce73 Revert ValidationMode.CALLBACK on JPA bootstrap
In gh-30549 we applied changes to the `DefaultPersistenceUnitManager` to
use the `ValidationMode.CALLBACK` to better detect invalid validation
setup and enforce bootstrap failures in those cases.

Unfortunately, doing so disables the detection of validation annotation
on entities during the schema creation phase. This is a known Hibernate
issue. This commit reverts this change until HHH-12287 is fixed.

Fixes gh-31726
2023-12-06 18:34:42 +01:00
Yanming Zhou afcd03bddc Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty()
Search for   : assertThat\((.+).isEmpty\(\)\).isTrue\(\)
Replace with : assertThat($1).isEmpty()

Search for   : assertThat\((.+).isEmpty\(\)\).isFalse\(\)
Replace with : assertThat($1).isNotEmpty()

Closes gh-31758
2023-12-06 10:04:56 +01:00
Yanming Zhou 7b16ef90f1 Replace assertThat(x.equals(y)) with assertThat(x).isEqualTo(y)
Search for   : assertThat\((.+)\.equals\((\w+)\)\)\.isTrue\(\)
Replace with : assertThat($1).isEqualTo($2)

Search for   : assertThat\((.+)\.equals\((\w+)\)\)\.isFalse\(\)
Replace with : assertThat($1).isNotEqualTo($2)

Closes gh-31763
2023-12-06 09:50:15 +01:00
Yanming Zhou 66e405525b Replace assertThat(x instanceof y).isTrue() with assertThat(x).isInstanceOf(y.class)
Search for   : assertThat\((.+) instanceof (\w+)\)\.isTrue\(\)
Replace with : assertThat($1).isInstanceOf($2.class)

Search for   : assertThat\((.+) instanceof (\w+)\)\.isFalse\(\)
Replace with : assertThat($1).isNotInstanceOf($2.class)

Closes gh-31760
2023-12-06 09:46:44 +01:00
Yanming Zhou 59815cefce Replace assertThat(x.get(i)). with assertThat(x).element(i).
Search for   : assertThat\((.+)\.get\((\d+)\)\)\.
Replace with : assertThat($1).element($2).

Closes gh-31759
2023-12-06 09:43:59 +01:00
Stéphane Nicoll 1da40b84e7 Polish "Use idiomatic AssertJ map assertions"
See gh-31752
2023-12-05 10:39:33 +01:00
Sam Brannen 62b3d7a963 Update copyright headers 2023-12-04 16:47:25 +01:00
Sam Brannen d71853f105 Polish contribution
See gh-31531
2023-12-04 16:47:25 +01:00
Yanming Zhou 490b5c77fc Use switch expression where feasible 2023-12-04 15:42:55 +01:00
Sam Brannen 6ea9fdbf77 Polishing 2023-11-30 19:04:59 +01:00
Sam Brannen a15f472898 Include scroll() in SharedEntityManagerCreator's queryTerminatingMethods
This commit supports the scroll() and scroll(ScrollMode) methods from
Hibernate's Query API in SharedEntityManagerCreator's query-terminating
methods set.

Closes gh-31682
2023-11-26 12:12:54 +01:00
Sébastien Deleuze 183c2f82b2 Refine `@EmbeddableInstantiator` reflection hints
Based on @odrotbohm proposal to manage a wider set
of use cases.

Closes gh-31534
2023-11-15 18:48:27 +01:00
Sébastien Deleuze 9d6bda2b44 Register Hibernate `@EmbeddableInstantiator` reflection hints
This commit updates PersistenceManagedTypesBeanRegistrationAotProcessor
to register reflection hints for `@EmbeddableInstantiator` annotations
available as of Hibernate 6.0 when needed.

Related tests will be added in
https://github.com/spring-projects/spring-aot-smoke-tests.

Closes gh-31534
2023-11-07 11:04:43 +01:00
Johnny Lim 2b750926c3 Polishing
Closes gh-31522
2023-10-30 15:05:20 +01:00
Dmitrii Bocharov ce778cee27 Fix spring-orm tests with eclipselink and Java 18+
See gh-31078
2023-10-24 16:49:58 +02:00
Johnny Lim 64e9fcad53 Apply SingleSpaceSeparator Checkstyle module
This commit also fixes its violations.

Closes gh-31469
2023-10-22 14:09:57 +02:00
Misagh Moayyed 1e7e532ed6 Fix typos in SubstituteOnlyIfPresent Javadoc
Closes gh-31455
2023-10-18 14:11:44 +02:00
Sébastien Deleuze a9d67878c5 Introduce conditional activation of Hibernate substitutions
Closes gh-31452
2023-10-18 12:16:58 +02:00
Johnny Lim 919faa2ce2 Order modifiers to align with JLS
This commit also applies Checkstyle ModifierOrder to enforce it.

See gh-31368
2023-10-17 16:13:56 +02:00
Juergen Hoeller 653a631df5 Merge branch '6.0.x'
# Conflicts:
#	spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java
2023-10-11 13:28:11 +02:00
Juergen Hoeller 66ce8c9a25 Properly return SQLExceptionTranslator-provided exception
Closes gh-31409
2023-10-11 13:13:22 +02:00
Juergen Hoeller e76b453685 Translate Hibernate TransactionException through SQLException cause
Closes gh-31274
2023-10-11 13:09:19 +02:00
Juergen Hoeller a3e13c8ba8 Merge branch '6.0.x'
# Conflicts:
#	spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java
2023-09-29 15:01:43 +02:00
Juergen Hoeller 407113945d Polishing 2023-09-29 14:58:02 +02:00
Stephane Nicoll 66a571fe27 Make constructorOrFactory method resolution optional
This commit allows a custom code fragment to provide the code to
create a bean without relying on ConstructorResolver. This is especially
important for use cases that derive from the default behaviour and
provide an instance supplier with the regular runtime scenario.

This is a breaking change for code fragments providing a custom
implementation of the related methods. As it turns out, almost all of
them did not need the Executable argument. Configuration class parsing
is the exception, where it needs to provide a different constructor in
the case of the proxy. To make this use case possible,
InstanceSupplierCodeGenerator has been made public.

Closes gh-31117
2023-09-11 15:55:22 +02:00
Sam Brannen e42902b742 Stop referring to JDO and outdated JDBC versions in documentation
Closes gh-31183
2023-09-07 13:26:38 +02:00
Sébastien Deleuze 0aa4dc11f1 Add missing graal-sdk dependency to spring-orm
See gh-29549
2023-09-01 12:47:47 +02:00
Sébastien Deleuze 63a20be502 Optimize Hibernate native footprint by making ByteBuddy unreachable
As a workaround before a proper solution the Spring team is trying to
find with the Hibernate team in a future version of Hibernate, this
commit introduces 2 GraalVM substitutions that should allow to remove
ByteBuddy reachability with Hibernate 6.3.

Closes gh-29549
2023-09-01 12:29:16 +02:00
Sébastien Deleuze 11abd8b04f Merge branch '6.0.x' 2023-08-18 17:25:50 +02:00
Sébastien Deleuze c91708c1c0 Add missing proxy hints for Hibernate native query
This commit contributes proxy hints needed by
SharedEntityManagerCreator for
org.hibernate.query.sql.internal.NativeQueryImpl interfaces.

A related smoke test has been contributed via
spring-projects/spring-aot-smoke-tests#188.

Closes gh-29603
2023-08-18 17:22:57 +02:00
Sébastien Deleuze 5641d87ce8 Merge branch '6.0.x' 2023-08-16 16:06:55 +02:00
Sébastien Deleuze 78a73e5f57 Add missing Hibernate 6.2 proxy hints
This commit contributes proxy hints needed by
SharedEntityManagerCreator for
org.hibernate.query.sqm.internal.QuerySqmImpl interfaces.

Until Hibernate 6.1, those hints were erroneously provided
at GraalVM reachability metadata level. As of Hibernate 6.2,
they are not, hence the need to contribute them at Spring
Framework level.

A related smoke test has been contributed via
spring-projects/spring-aot-smoke-tests#188.

Closes gh-31050
2023-08-16 15:57:05 +02:00
Juergen Hoeller 4e863c5a75 Merge branch '6.0.x' 2023-08-04 02:40:17 +02:00
Juergen Hoeller 18966d048c Consistent equals/hashCode style (and related polishing) 2023-08-04 02:39:31 +02:00
Juergen Hoeller d250a5155a Consistent dependency declarations 2023-08-02 00:56:50 +02:00