Prior to this commit, JpaTransactionManager and
HibernateTransactionManager stated that they do not support "running
within DataSourceTransactionManager" when encountering a pre-bound
JDBC Connection that is not synchronized with a transaction.
However, DataSourceTransactionManager marks its ConnectionHolder as
synchronized with the transaction and therefore does not trigger this
check. Instead, the exception is typically caused by another
JpaTransactionManager or HibernateTransactionManager for a different
persistence unit exposing a JDBC Connection for the same DataSource,
or by a JDBC Connection that has been left bound to the current
thread.
This commit revises the exception message accordingly so that it no
longer points to DataSourceTransactionManager.
See gh-14130
Closes gh-37356
Signed-off-by: rene.schakmann <rene.schakmann@reetgroup.com>
Prior to this commit, Hibernate 8 types extending
`MutationOrSelectionQuery` would fail proxying at runtime in native
images because reflection hints were not registered at build time.
While the `MutationOrSelectionQueryImpl` case can be solved with an
additional proxy hint, `NativeMutationOrSelectionQueryImpl` is
impossible to solve that way due to multi interface mismatch.
This was found in gh-36878 and handled with a fallback proxy.
In this case, native image will throw a
`MissingReflectionRegistrationError` - but obviously we cannot depend on
this type in JVM applications. `MissingReflectionRegistrationError`
extends `LinkageError`, which we will use along
IllegalArgumentException` to detect that the proxying operation failed
and that we should use the fallback.
This commit also register a proxy hint for the said fallback.
Fixes gh-37251
This commit adds the missing reflection hints for Hibernate 8 support:
`PersistenceUnitInfoDescriptor` and `StatelessSession`.
Fixes gh-37247
Fixes gh-37249
Includes fix for consistent PersistenceException in case of no unit found for name.
Includes proper tests for Local(Container)EntityManagerFactoryBean with scan setup.
Closes gh-36270
Closes gh-36271