Skip to content
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

Hibernate Reactive 2.0.0.Alpha2 & re-enabling all HR modules #31454

Merged
merged 20 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
16c8b7f
Upgrade to Hibernate ORM 6.2.0.CR4
Sanne Mar 17, 2023
8862c57
Revert "Disable Hibernate Reactive modules in native-tests.json"
Sanne Feb 21, 2023
b7802b4
Revert "Disable the Hibernate Reactive modules"
Sanne Feb 21, 2023
e6d8b4f
Adapt the Hibernate Reactive bootstrap code to Hibernate ORM core 6.2
Sanne Feb 21, 2023
07b6f34
Switch to Hibernate Reactive 2.0.0.Alpha2
Sanne Feb 21, 2023
c814abd
Adapt the Hibernate Reactive extension to Hibernate Reactive 2.0
Sanne Feb 21, 2023
23ba8c0
Switch to Jakarta configuration properties
Sanne Feb 23, 2023
6f8e32c
Prevent warnings about using an unexpected PostgreSQL JDBC driver
Sanne Feb 23, 2023
6f31f5e
Fix compilation errors in Panache Reactive's CommonPanacheQueryImpl
Sanne Feb 27, 2023
312b798
Fix compilation errors in integration tests: hibernate-reactive-panac…
Sanne Feb 27, 2023
e0e3dc0
Adapt Hibernate Reactive extension to new Services refactoring in ORM…
Sanne Feb 27, 2023
746ef90
Update expectations of integration tests
Sanne Feb 27, 2023
eb705e4
New services introduced in Hibernate ORM 6.2.0.CR3
Sanne Mar 1, 2023
f605f06
Adapt the HR extension after recent changes
Sanne Mar 11, 2023
3dc347d
Service renamed for Hibernate Reactive: ParameterMarkerStrategy
Sanne Mar 15, 2023
4522186
Fixes for HR2 in HR/Panache IT tests
FroMage Mar 8, 2023
f6584a1
Requires investigation: disable failing tests in hibernate-reactive-r…
Sanne Mar 13, 2023
4a1d59f
Reconfigure kubernetes-service-binding-reactive integration tests for…
Sanne Mar 13, 2023
1abf81b
Reworked how rest-data-panache listeners work on after listeners
FroMage Mar 17, 2023
2f2caf4
Fix integration tests: hibernate-reactive-panache-kotlin
Sanne Mar 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/native-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
{
"category": "Data5",
"timeout": 65,
"test-modules": "jpa-postgresql, jpa-postgresql-withxml, narayana-stm, narayana-jta, reactive-pg-client, hibernate-orm-tenancy/schema",
"test-modules": "jpa-postgresql, jpa-postgresql-withxml, narayana-stm, narayana-jta, reactive-pg-client, hibernate-reactive-postgresql, hibernate-orm-tenancy/schema",
"os-name": "ubuntu-latest"
},
{
"category": "Data6",
"timeout": 80,
"test-modules": "elasticsearch-rest-client, elasticsearch-rest-high-level-client, elasticsearch-java-client, hibernate-search-orm-elasticsearch, hibernate-search-orm-elasticsearch-tenancy, hibernate-search-orm-opensearch, hibernate-search-orm-elasticsearch-coordination-outbox-polling",
"test-modules": "elasticsearch-rest-client, elasticsearch-rest-high-level-client, elasticsearch-java-client, hibernate-search-orm-elasticsearch, hibernate-search-orm-elasticsearch-tenancy, hibernate-search-orm-opensearch, hibernate-search-orm-elasticsearch-coordination-outbox-polling, hibernate-reactive-panache, hibernate-reactive-panache-kotlin",
"os-name": "ubuntu-latest"
},
{
"category": "Data7",
"timeout": 65,
"test-modules": "reactive-oracle-client, reactive-mysql-client, reactive-db2-client",
"test-modules": "reactive-oracle-client, reactive-mysql-client, reactive-db2-client, hibernate-reactive-db2, hibernate-reactive-mysql",
"os-name": "ubuntu-latest"
},
{
Expand Down Expand Up @@ -81,7 +81,7 @@
{
"category": "Security3",
"timeout": 50,
"test-modules": "keycloak-authorization, smallrye-jwt-token-propagation",
"test-modules": "keycloak-authorization, smallrye-jwt-token-propagation, security-webauthn",
"os-name": "ubuntu-latest"
},
{
Expand Down
6 changes: 3 additions & 3 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-codec.version>1.15</commons-codec.version>
<classmate.version>1.5.1</classmate.version>
<hibernate-orm.version>6.2.0.CR3</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<hibernate-orm.version>6.2.0.CR4</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<bytebuddy.version>1.12.18</bytebuddy.version> <!-- Version controlled by Hibernate ORM's needs -->
<hibernate-commons-annotations.version>6.0.6.Final</hibernate-commons-annotations.version> <!-- version controlled by Hibernate ORM -->
<hibernate-reactive.version>1.1.9.Final</hibernate-reactive.version>
<hibernate-reactive.version>2.0.0.Alpha2</hibernate-reactive.version>
<hibernate-validator.version>8.0.0.Final</hibernate-validator.version>
<hibernate-search.version>6.1.7.Final</hibernate-search.version>
<narayana.version>6.0.0.Final</narayana.version>
Expand Down Expand Up @@ -5134,7 +5134,7 @@
</dependency>
<dependency>
<groupId>org.hibernate.reactive</groupId>
<artifactId>hibernate-reactive-core-jakarta</artifactId>
<artifactId>hibernate-reactive-core</artifactId>
<version>${hibernate-reactive.version}</version>
</dependency>
<dependency>
Expand Down
65 changes: 65 additions & 0 deletions devtools/bom-descriptor-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,71 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache-common</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache-kotlin</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-rest-data-panache</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-search-orm-coordination-outbox-polling</artifactId>
Expand Down
65 changes: 65 additions & 0 deletions docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,71 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache-common-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache-kotlin-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-rest-data-panache-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-search-orm-coordination-outbox-polling-deployment</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.hibernate.resource.transaction.internal.TransactionCoordinatorBuilderInitiator;
import org.hibernate.service.internal.ProvidedService;
import org.hibernate.service.internal.SessionFactoryServiceRegistryFactoryInitiator;
import org.hibernate.sql.ast.internal.JdbcParameterRendererInitiator;
import org.hibernate.sql.ast.internal.ParameterMarkerStrategyInitiator;
import org.hibernate.sql.results.jdbc.internal.JdbcValuesMappingProducerProviderInitiator;
import org.hibernate.tool.schema.internal.SchemaManagementToolInitiator;

Expand Down Expand Up @@ -232,7 +232,7 @@ private static List<StandardServiceInitiator<?>> buildQuarkusServiceInitiatorLis
serviceInitiators.add(SqmMultiTableMutationStrategyProviderInitiator.INSTANCE);

// Default implementation
serviceInitiators.add(JdbcParameterRendererInitiator.INSTANCE);
serviceInitiators.add(ParameterMarkerStrategyInitiator.INSTANCE);

serviceInitiators.trimToSize();
return serviceInitiators;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.hibernate.query.sqm.mutation.internal.SqmMultiTableMutationStrategyProviderInitiator;
import org.hibernate.resource.transaction.internal.TransactionCoordinatorBuilderInitiator;
import org.hibernate.service.internal.SessionFactoryServiceRegistryFactoryInitiator;
import org.hibernate.sql.ast.internal.JdbcParameterRendererInitiator;
import org.hibernate.sql.ast.internal.ParameterMarkerStrategyInitiator;
import org.hibernate.sql.results.jdbc.internal.JdbcValuesMappingProducerProviderInitiator;
import org.hibernate.tool.schema.internal.SchemaManagementToolInitiator;

Expand Down Expand Up @@ -102,7 +102,7 @@ public List<StandardServiceInitiator<?>> initialInitiatorList() {
serviceInitiators.add(SqmMultiTableMutationStrategyProviderInitiator.INSTANCE);

// Default implementation
serviceInitiators.add(JdbcParameterRendererInitiator.INSTANCE);
serviceInitiators.add(ParameterMarkerStrategyInitiator.INSTANCE);

serviceInitiators.trimToSize();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.quarkus.hibernate.reactive.deployment;

import java.util.List;

import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.hibernate.orm.deployment.spi.DatabaseKindDialectBuildItem;
import io.quarkus.hibernate.orm.runtime.HibernateOrmRuntimeConfig;
import io.quarkus.runtime.configuration.ConfigurationException;

/**
* This used to be the approach before 6bf38240 in the Hibernate ORM extension as well.
* Align to ORM? TBD
*/
@Deprecated
final class Dialects {

private Dialects() {
//utility
}

public static String guessDialect(String persistenceUnitName, String resolvedDbKind,
List<DatabaseKindDialectBuildItem> dbKindDialectBuildItems) {
for (DatabaseKindDialectBuildItem item : dbKindDialectBuildItems) {
if (DatabaseKind.is(resolvedDbKind, item.getDbKind())) {
return item.getDialect();
}
}

String error = "The Hibernate ORM extension could not guess the dialect from the database kind '" + resolvedDbKind
+ "'. Add an explicit '" + HibernateOrmRuntimeConfig.puPropertyKey(persistenceUnitName, "dialect")
+ "' property.";
throw new ConfigurationException(error);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public final class HibernateReactiveLogFilter {
void setupLogFilters(BuildProducer<LogCleanupFilterBuildItem> filters) {
filters.produce(new LogCleanupFilterBuildItem(
"org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator", "HHH000181"));
//See https://hibernate.atlassian.net/browse/HHH-16224
filters.produce(new LogCleanupFilterBuildItem(
"org.hibernate.dialect.PostgreSQLPGObjectJdbcType", "HHH000514"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;
import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT;
import static io.quarkus.hibernate.orm.deployment.HibernateConfigUtil.firstPresent;
import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_MODE;
import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_MODE;
import static org.hibernate.cfg.AvailableSettings.USE_DIRECT_REFERENCE_CACHE_ENTRIES;
import static org.hibernate.cfg.AvailableSettings.USE_QUERY_CACHE;
import static org.hibernate.cfg.AvailableSettings.USE_SECOND_LEVEL_CACHE;
Expand Down Expand Up @@ -47,7 +47,6 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
import io.quarkus.deployment.recording.RecorderContext;
import io.quarkus.hibernate.orm.deployment.Dialects;
import io.quarkus.hibernate.orm.deployment.HibernateConfigUtil;
import io.quarkus.hibernate.orm.deployment.HibernateOrmConfig;
import io.quarkus.hibernate.orm.deployment.HibernateOrmConfigPersistenceUnit;
Expand All @@ -61,7 +60,7 @@
import io.quarkus.hibernate.orm.deployment.spi.DatabaseKindDialectBuildItem;
import io.quarkus.hibernate.orm.runtime.HibernateOrmRuntimeConfig;
import io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil;
import io.quarkus.hibernate.orm.runtime.recording.RecordedConfig
import io.quarkus.hibernate.orm.runtime.recording.RecordedConfig;
import io.quarkus.hibernate.reactive.runtime.FastBootHibernateReactivePersistenceProvider;
import io.quarkus.hibernate.reactive.runtime.HibernateReactive;
import io.quarkus.hibernate.reactive.runtime.HibernateReactiveRecorder;
Expand Down Expand Up @@ -217,6 +216,7 @@ PersistenceProviderSetUpBuildItem setUpPersistenceProviderAndWaitForVertxPool(Hi
// and we've seen in the past that features we add to handleHibernateORMWithNoPersistenceXml
// tend not to be added here.
// See https://github.com/quarkusio/quarkus/issues/28629.
//see producePersistenceUnitDescriptorFromConfig in ORM
private static ParsedPersistenceXmlDescriptor generateReactivePersistenceUnit(
HibernateOrmConfig hibernateOrmConfig, CombinedIndexBuildItem index,
HibernateOrmConfigPersistenceUnit persistenceUnitConfig,
Expand Down Expand Up @@ -379,7 +379,7 @@ private static ParsedPersistenceXmlDescriptor generateReactivePersistenceUnit(
p.putIfAbsent(USE_DIRECT_REFERENCE_CACHE_ENTRIES, Boolean.TRUE);
p.putIfAbsent(USE_SECOND_LEVEL_CACHE, Boolean.TRUE);
p.putIfAbsent(USE_QUERY_CACHE, Boolean.TRUE);
p.putIfAbsent(JPA_SHARED_CACHE_MODE, SharedCacheMode.ENABLE_SELECTIVE);
p.putIfAbsent(JAKARTA_SHARED_CACHE_MODE, SharedCacheMode.ENABLE_SELECTIVE);
Map<String, String> cacheConfigEntries = HibernateConfigUtil.getCacheConfigEntries(persistenceUnitConfig);
for (Entry<String, String> entry : cacheConfigEntries.entrySet()) {
desc.getProperties().setProperty(entry.getKey(), entry.getValue());
Expand All @@ -390,7 +390,7 @@ private static ParsedPersistenceXmlDescriptor generateReactivePersistenceUnit(
p.put(USE_DIRECT_REFERENCE_CACHE_ENTRIES, Boolean.FALSE);
p.put(USE_SECOND_LEVEL_CACHE, Boolean.FALSE);
p.put(USE_QUERY_CACHE, Boolean.FALSE);
p.put(JPA_SHARED_CACHE_MODE, SharedCacheMode.NONE);
p.put(JAKARTA_SHARED_CACHE_MODE, SharedCacheMode.NONE);
}

return desc;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.quarkus.hibernate.reactive.services;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

import org.hibernate.boot.registry.StandardServiceInitiator;
import org.hibernate.reactive.provider.impl.ReactiveServiceInitiators;
import org.hibernate.service.StandardServiceInitiators;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class ServiceInitiatorsTest {

private static final Map<String, String> HR_SERVICES = toServicesMap(ReactiveServiceInitiators.LIST);
private static final Map<String, String> ORM_SERVICES = toServicesMap(StandardServiceInitiators.LIST);
private static final Map<String, String> QUARKUS_HR_SERVICES = toServicesMap(ReactiveServiceInitiators.LIST);

// These services are NOT provided by the Hibernate Reactive default initiators, and that should be fine:
private static final Set<String> HR_INTENTIONALLY_OMITTED = Set
.of("org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformResolver");

@Test
public void serviceInitiatorsAreUnique() {
Assertions.assertEquals(HR_SERVICES.size(), ReactiveServiceInitiators.LIST.size());
Assertions.assertEquals(ORM_SERVICES.size(), StandardServiceInitiators.LIST.size());
Assertions.assertEquals(ORM_SERVICES.size(), StandardServiceInitiators.LIST.size());
}

private static Map<String, String> toServicesMap(List<StandardServiceInitiator<?>> list) {
TreeMap<String, String> rolesToImplMap = new TreeMap<>();
for (StandardServiceInitiator<?> initiator : list) {
final String serviceRole = initiator.getServiceInitiated().getName();
rolesToImplMap.put(serviceRole, initiator.getClass().getName());
}
return Collections.unmodifiableMap(rolesToImplMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void testIncluded(UniAsserter asserter) {
public void testExcluded(UniAsserter asserter) {
ExcludedEntity entity = new ExcludedEntity("gsmet");
asserter.assertFailedWith(() -> persist(entity), t -> {
assertThat(t).hasMessageContaining("Unknown entity");
assertThat(t).hasMessageContaining("Unable to locate persister");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void testIncluded(UniAsserter asserter) {
public void testExcluded(UniAsserter asserter) {
ExcludedEntity entity = new ExcludedEntity("gsmet");
asserter.assertFailedWith(() -> persist(entity), t -> {
assertThat(t).hasMessageContaining("Unknown entity");
assertThat(t).hasMessageContaining("Unable to locate persister:");
});
}

Expand Down
Loading