diff --git a/bom/application/pom.xml b/bom/application/pom.xml
index fa6a266d330e68..91801d1a1d9567 100644
--- a/bom/application/pom.xml
+++ b/bom/application/pom.xml
@@ -101,7 +101,7 @@
bytebuddy.version (just below), hibernate-orm.version-for-documentation (in docs/pom.xml)
and antlr.version.version in build-parent/pom.xml
WARNING again for diffs that don't provide enough context: when updating, see above -->
- 6.3.1.Final
+ 6.4.0.CR1
1.14.7
6.0.6.Final
2.0.6.Final
@@ -190,7 +190,7 @@
2.1.SP1
5.3.1
5.8.0
- 4.10.1
+ 4.13.0
2.0.2.Final
22.0.5
1.15.1
diff --git a/build-parent/pom.xml b/build-parent/pom.xml
index 36206399fc121e..111f456ae80c1b 100644
--- a/build-parent/pom.xml
+++ b/build-parent/pom.xml
@@ -72,7 +72,7 @@
- 4.10.1
+ 4.13.0
:Z
diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java
index 52db112ee6e5f5..aa438dce8eaf07 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java
@@ -197,7 +197,7 @@ protected void populate(String persistenceUnitName, SessionFactoryOptionsBuilder
// Should be added in case of discriminator strategy too, that is not handled by options.isMultiTenancyEnabled()
if (options.isMultiTenancyEnabled()
|| (multiTenancyStrategy != null && multiTenancyStrategy != MultiTenancyStrategy.NONE)) {
- options.applyCurrentTenantIdentifierResolver(new HibernateCurrentTenantIdentifierResolver(persistenceUnitName));
+ options.applyCurrentTenantIdentifierResolver(new HibernateCurrentTenantIdentifierResolver<>(persistenceUnitName));
}
InjectableInstance interceptorInstance = PersistenceUnitUtil.singleExtensionInstanceForPersistenceUnit(
diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateCurrentTenantIdentifierResolver.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateCurrentTenantIdentifierResolver.java
index 1989224a064068..0ea4daf2768e67 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateCurrentTenantIdentifierResolver.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateCurrentTenantIdentifierResolver.java
@@ -15,7 +15,7 @@
* @author Michael Schnell
*
*/
-public final class HibernateCurrentTenantIdentifierResolver implements CurrentTenantIdentifierResolver {
+public final class HibernateCurrentTenantIdentifierResolver implements CurrentTenantIdentifierResolver {
private static final Logger LOG = Logger.getLogger(HibernateCurrentTenantIdentifierResolver.class);
@@ -26,15 +26,15 @@ public HibernateCurrentTenantIdentifierResolver(String persistenceUnitName) {
}
@Override
- public String resolveCurrentTenantIdentifier() {
+ public T resolveCurrentTenantIdentifier() {
// Make sure that we're in a request
if (!Arc.container().requestContext().isActive()) {
return null;
}
- TenantResolver resolver = tenantResolver(persistenceUnitName);
- String tenantId = resolver.resolveTenantId();
+ TenantResolver resolver = tenantResolver(persistenceUnitName);
+ T tenantId = resolver.resolveTenantId();
if (tenantId == null) {
throw new IllegalStateException("Method 'TenantResolver.resolveTenantId()' returned a null value. "
+ "Unfortunately Hibernate ORM does not allow null for tenant identifiers. "
@@ -51,19 +51,20 @@ public boolean validateExistingCurrentSessions() {
}
@Override
- public boolean isRoot(String tenantId) {
+ public boolean isRoot(T tenantId) {
// Make sure that we're in a request
if (!Arc.container().requestContext().isActive()) {
return false;
}
- TenantResolver resolver = tenantResolver(persistenceUnitName);
+ TenantResolver resolver = tenantResolver(persistenceUnitName);
if (resolver == null) {
return false;
}
return resolver.isRoot(tenantId);
}
- private static TenantResolver tenantResolver(String persistenceUnitName) {
+ @SuppressWarnings({"rawtypes", "unchecked"}) // The type T doesn't matter here
+ private static TenantResolver tenantResolver(String persistenceUnitName) {
InjectableInstance instance = PersistenceUnitUtil.legacySingleExtensionInstanceForPersistenceUnit(
TenantResolver.class, persistenceUnitName);
if (instance.isUnsatisfied()) {
@@ -72,7 +73,7 @@ private static TenantResolver tenantResolver(String persistenceUnitName) {
+ "You need to create an implementation for this interface to allow resolving the current tenant identifier.",
TenantResolver.class.getSimpleName(), persistenceUnitName));
}
- return instance.get();
+ return (TenantResolver) instance.get();
}
}
diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/TenantResolver.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/TenantResolver.java
index 39d581b4f52649..9442d7a92f1187 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/TenantResolver.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/TenantResolver.java
@@ -5,15 +5,19 @@
*
* @author Michael Schnell
*
+ * @param The type of tenant identifiers.
+ * If you use `@TenantId`, this is the type of the `@TenantId`-annotated property.
+ * Otherwise, use `String`.
+ *
*/
-public interface TenantResolver {
+public interface TenantResolver {
/**
* Returns the identifier of the default tenant.
*
* @return Default tenant.A non-{@literal null} value is required.
*/
- String getDefaultTenantId();
+ T getDefaultTenantId();
/**
* Returns the current tenant identifier.
@@ -21,7 +25,7 @@ public interface TenantResolver {
* @return the tenant identifier. This value will be used to select the proper configuration at runtime. A
* non-{@literal null} value is required.
*/
- String resolveTenantId();
+ T resolveTenantId();
/**
* Does the given tenant id represent a "root" tenant with access to all partitions?
@@ -30,7 +34,7 @@ public interface TenantResolver {
*
* @return true is this is root tenant
*/
- default boolean isRoot(String tenantId) {
+ default boolean isRoot(T tenantId) {
return false;
}
diff --git a/extensions/security-jpa/deployment/src/test/java/io/quarkus/security/jpa/CustomHibernateTenantResolver.java b/extensions/security-jpa/deployment/src/test/java/io/quarkus/security/jpa/CustomHibernateTenantResolver.java
index a5b87c2e2e9d07..1fdeff89c5d806 100644
--- a/extensions/security-jpa/deployment/src/test/java/io/quarkus/security/jpa/CustomHibernateTenantResolver.java
+++ b/extensions/security-jpa/deployment/src/test/java/io/quarkus/security/jpa/CustomHibernateTenantResolver.java
@@ -9,7 +9,7 @@
@PersistenceUnitExtension
@RequestScoped
-public class CustomHibernateTenantResolver implements TenantResolver {
+public class CustomHibernateTenantResolver implements TenantResolver {
static volatile boolean useRoutingContext = false;
diff --git a/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java b/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
index 45cf43533c932f..50bbffe544c5c3 100644
--- a/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
@@ -9,7 +9,7 @@
import io.vertx.ext.web.RoutingContext;
@RequestScoped
-public class CustomTenantResolver implements TenantResolver {
+public class CustomTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(CustomTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java b/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
index b54162ef3c73f0..c704e5a93919ff 100644
--- a/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
@@ -11,7 +11,7 @@
@RequestScoped
@PersistenceUnit("inventory")
-public class InventoryTenantResolver implements TenantResolver {
+public class InventoryTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(InventoryTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java b/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
index 424bb8087c0c36..81bcb23cdaf658 100644
--- a/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension
@RequestScoped
-public class CustomTenantResolver implements TenantResolver {
+public class CustomTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(CustomTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java b/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
index 3dc77844c31023..82dd39513b7535 100644
--- a/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension("inventory")
@RequestScoped
-public class InventoryTenantResolver implements TenantResolver {
+public class InventoryTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(InventoryTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java b/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
index 424bb8087c0c36..81bcb23cdaf658 100644
--- a/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension
@RequestScoped
-public class CustomTenantResolver implements TenantResolver {
+public class CustomTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(CustomTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java b/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
index 3dc77844c31023..82dd39513b7535 100644
--- a/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension("inventory")
@RequestScoped
-public class InventoryTenantResolver implements TenantResolver {
+public class InventoryTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(InventoryTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java b/integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
index c4c910189850ad..87df629bbd1cd6 100644
--- a/integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension
@RequestScoped
-public class CustomTenantResolver implements TenantResolver {
+public class CustomTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(CustomTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java b/integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
index 3dc77844c31023..82dd39513b7535 100644
--- a/integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension("inventory")
@RequestScoped
-public class InventoryTenantResolver implements TenantResolver {
+public class InventoryTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(InventoryTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java b/integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
index 424bb8087c0c36..81bcb23cdaf658 100644
--- a/integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/CustomTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension
@RequestScoped
-public class CustomTenantResolver implements TenantResolver {
+public class CustomTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(CustomTenantResolver.class);
diff --git a/integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java b/integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
index 3dc77844c31023..82dd39513b7535 100644
--- a/integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
+++ b/integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/inventory/InventoryTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension("inventory")
@RequestScoped
-public class InventoryTenantResolver implements TenantResolver {
+public class InventoryTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(InventoryTenantResolver.class);
diff --git a/integration-tests/hibernate-search-orm-elasticsearch-tenancy/src/main/java/io/quarkus/it/hibernate/search/orm/elasticsearch/multitenancy/fruit/CustomTenantResolver.java b/integration-tests/hibernate-search-orm-elasticsearch-tenancy/src/main/java/io/quarkus/it/hibernate/search/orm/elasticsearch/multitenancy/fruit/CustomTenantResolver.java
index 81ee28f55ed1ec..6e4bc49aaa48de 100644
--- a/integration-tests/hibernate-search-orm-elasticsearch-tenancy/src/main/java/io/quarkus/it/hibernate/search/orm/elasticsearch/multitenancy/fruit/CustomTenantResolver.java
+++ b/integration-tests/hibernate-search-orm-elasticsearch-tenancy/src/main/java/io/quarkus/it/hibernate/search/orm/elasticsearch/multitenancy/fruit/CustomTenantResolver.java
@@ -11,7 +11,7 @@
@PersistenceUnitExtension
@RequestScoped
-public class CustomTenantResolver implements TenantResolver {
+public class CustomTenantResolver implements TenantResolver {
private static final Logger LOG = Logger.getLogger(CustomTenantResolver.class);
diff --git a/integration-tests/jpa/src/main/java/io/quarkus/it/jpa/generatedvalue/CustomTenantResolver.java b/integration-tests/jpa/src/main/java/io/quarkus/it/jpa/generatedvalue/CustomTenantResolver.java
index 7afb150cfe68d6..5874d6ff78337c 100644
--- a/integration-tests/jpa/src/main/java/io/quarkus/it/jpa/generatedvalue/CustomTenantResolver.java
+++ b/integration-tests/jpa/src/main/java/io/quarkus/it/jpa/generatedvalue/CustomTenantResolver.java
@@ -7,7 +7,7 @@
@PersistenceUnitExtension
@RequestScoped
-public class CustomTenantResolver implements TenantResolver {
+public class CustomTenantResolver implements TenantResolver {
private static final String DEFAULT_TENANT = "default";