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

Upgrade to Hibernate ORM 6.2 #31235

Merged
merged 83 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
c24ba8f
Upgrade to ORM 6.2.0.CR2 & matching HCANN, JPA, Cache versions
Sanne Nov 20, 2022
0f54bd1
Use the Hibernate Search artifacts integrating with Hibernate ORM 6
gsmet Feb 17, 2023
13a496a
QueryPlanCache#DEFAULT_QUERY_PLAN_MAX_COUNT changed constant
Sanne Jul 8, 2022
c697f6c
Generics change in ProxyDefinitions
Sanne Jul 8, 2022
2104ccc
Services: no longer need a custom JmxService
Sanne Jul 11, 2022
8474e70
Services: No longer need to customize the BatchBuilderInitiator
Sanne Jul 11, 2022
230c347
Services: No longer refer Service Initiator: QueryTranslatorFactoryIn…
Sanne Jul 11, 2022
14c0776
Services: no longer need to disable JACC integrations
Sanne Jul 11, 2022
3dfa13c
Services: no longer refer to QueryTranslatorFactoryInitiator
Sanne Jul 11, 2022
8c710a5
Services: changed name ImportSqlCommandExtractor to SqlScriptCommandE…
Sanne Jul 11, 2022
973c18a
HQLQueryPlan has been removed
Sanne Jul 11, 2022
3feee91
New contract for EntityNotFoundDelegate
Sanne Jul 11, 2022
8efe97a
Removed SPI: SessionFactoryOptionsBuilder.getMultiTenancyStrategy()
Sanne Jul 11, 2022
50c7572
ORM Bootstrap: adapt to new EntityManagerFactoryBuilder SPI
Sanne Jul 11, 2022
db20a5e
Adapt to SPI changes: QuarkusProxyFactory
Sanne Jul 11, 2022
ec66094
ORM Bootstrap: adapt PreconfiguredServiceRegistryBuilder
Sanne Jul 12, 2022
750860e
Adapt to new ProxyFactoryFactory SPI
Sanne Jul 12, 2022
b38bb27
Adapt QuarkusStrategySelectorBuilder to changes in StrategySelectorBu…
Sanne Jul 12, 2022
c4ff715
Adapting delegation in TransactionScopedSession
Sanne Jul 12, 2022
9f58f17
Adapt schema management integration
Sanne Jul 12, 2022
a37477b
Adapt QuarkusManagedBeanRegistry to new SPI requirements
Sanne Jul 12, 2022
c66d1ad
Bootstrap: service initiations and provider lists now use wildcard ge…
Sanne Jul 14, 2022
9919b74
Bootstrap: adapt our custom StandardServiceRegistryBuilder implementa…
Sanne Jul 14, 2022
0a66762
Adapt code in FastBootMetadataBuilder
Sanne Jul 14, 2022
1cdfb81
Adapt the Dialects integration to stateful, versioned dialects
Sanne Jul 15, 2022
20b8e14
Enforce and warn to not use the vanilla org.hibernate.dialect.H2Dialect
Sanne Jul 18, 2022
36e3346
SqlFunction changed to SqmFunctionDescriptor in SPI signatures
Sanne Jul 15, 2022
c4f5c09
Adapt custom MetadataImplementor implementation
Sanne Jul 15, 2022
be19a10
Some constants are also pointing to legacy javax.persistence strings
Sanne Jul 15, 2022
7372fbd
Update the hardcoded references to ORM annotations
Sanne Jul 19, 2022
4cd16fa
Remove references to @TypeDef and @TypeDefs
Sanne Jul 19, 2022
1a11414
Jackson, Jaxb and JsonB Type integration packages have been moved
Sanne Sep 30, 2022
f321d64
Adjust getReference methods to match modified Session API
Sanne Sep 30, 2022
4884a03
More generics mismatch
Sanne Nov 20, 2022
b2cddcc
More annotations and SPIs moved
Sanne Feb 5, 2023
a857e38
Re-implement the IdentifierGenerator integrations to match Hibernate …
Sanne Feb 5, 2023
2c0cfbd
Additional delegate methods in TransactionScopedSession
Sanne Feb 5, 2023
0b51d86
Changed SPI in MetadataImplementor from ORM 6.2
Sanne Feb 5, 2023
8cf2261
Register new Column Ordering strategies for bootstrap
Sanne Feb 10, 2023
c555b95
Create a runtime version of the BytecodeProvider to address the parti…
Sanne Feb 11, 2023
e03aeba
Enable the new MutationExecutorService introduced in ORM 6.2
Sanne Feb 11, 2023
b0cc4be
Introduce new SessionFactoryObserver implementations
Sanne Feb 12, 2023
eaceb07
Adapt to new error message in Hibernate ORM 6.2 on unmatched entity p…
Sanne Feb 12, 2023
c0a9521
Register newly introduce mapping annotations
Sanne Feb 12, 2023
a9a4335
Update Logging filters
Sanne Feb 13, 2023
ee1b12b
Capability to log SQL bind parameters needs to change logging categories
Sanne Feb 13, 2023
6a5c12a
Devconsole: restore functionality of HibernateOrmDevConsoleInfoSupplier
Sanne Feb 13, 2023
8177fed
No longer need environment properties to control the BytecodeProvider…
Sanne Feb 14, 2023
ffa2297
Re-enable support for XML based mapping definitions
Sanne Feb 14, 2023
ea1b3a9
Better warnings for removed configuration properties
Sanne Feb 14, 2023
9f074cd
Removal of ALLOW_ENHANCEMENT_AS_PROXY
Sanne Feb 10, 2023
ab8f230
Rethink integration of upfront prepared enhanced proxies
Sanne Feb 15, 2023
4d28e5d
Add multi tenant connection provider before building standard service…
marko-bekhta Feb 21, 2023
5ff8d38
Rewrite CustomMetadataBuilderContributor to become a FunctionContributor
Sanne Feb 16, 2023
96bc473
Need to register the composite keys defined by @jakarta.persistence.I…
Sanne Feb 17, 2023
d318654
Fix DevConsole integration tests for DDL failures
Sanne Feb 16, 2023
5e0abb9
Update the test for package-level annotations
Sanne Feb 16, 2023
6f721c4
Panache Common: no need to use internal APIs to set query boundaries
Sanne Feb 16, 2023
2ce6cbc
Panache ORM: Fix compatibility of CustomCountPanacheQuery
Sanne Feb 16, 2023
f22af66
No longer needing the NativeImageFeature for HQL parsing support
Sanne Feb 16, 2023
9fd3e81
Switch the Hibernate Envers extension to Hibernate ORM 6
gsmet Feb 17, 2023
c449013
Fix small compilation issues in Panache ITs
gsmet Feb 17, 2023
f52569c
Integration tests: 'hibernate-orm-panache-kotlin'
gsmet Feb 17, 2023
1039688
Integration tests: fix the 'main' module integration tests: remove us…
marko-bekhta Feb 17, 2023
9322f17
Integration tests: fix the 'jpa-postgresql' module
Sanne Feb 17, 2023
52d3cdf
Integration tests: fix the 'jpa-postgresql-withxml' module
Sanne Feb 17, 2023
9318052
Integration tests: fix the 'jpa' module
Sanne Feb 17, 2023
38d6f8c
Integration tests: fix the 'jpa-h2' module
Sanne Feb 17, 2023
44d8cfc
Integration tests: fix the 'hibernate-orm-rest-data-panache' module
FroMage Feb 17, 2023
5730675
Integration tests: 'hibernate-orm-tenancy' to not use deprecated dial…
marko-bekhta Feb 17, 2023
c33d360
Workaround for the missing GraalVM metadata in Hibernate ORM
Sanne Feb 17, 2023
286cfee
Align the GraalVM DisableLoggingFeature to filter the right categories
Sanne Feb 17, 2023
efcb5c2
Silence Envers warnings during native image building
gsmet Feb 17, 2023
d94820e
Be less verbose in DisableLoggingFeature
gsmet Feb 17, 2023
1070d57
Integration tests: fix the 'spring-data-rest' module
Sanne Feb 17, 2023
387a24e
Integrations: fix integration between ORM and BVAL
Sanne Feb 17, 2023
b2fefc3
Integration tests: fix the 'cache' module
Sanne Feb 17, 2023
4f5c01a
Integration tests: fix 'spring-data-rest' module
Sanne Feb 17, 2023
3c2c58e
Updated ORM/Panache due to `update from` deletion
FroMage Feb 20, 2023
5902208
Integration tests: fix 'hibernate-orm-rest-data-panache' module
FroMage Feb 20, 2023
d7b3e14
Integration tests: fix 'hibernate-orm-graphql-panache' module
FroMage Feb 20, 2023
285f615
Integration tests: fix 'spring-data-jpa' module
Sanne Feb 20, 2023
c23c65b
Integration tests: fix 'infinispan-cache-jpa' module
Sanne Feb 20, 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
34 changes: 15 additions & 19 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<jakarta.interceptor-api.version>2.1.0</jakarta.interceptor-api.version>
<jakarta.json.bind-api.version>3.0.0</jakarta.json.bind-api.version>
<jakarta.mail.version>2.0.1</jakarta.mail.version>
<jakarta.persistence-api.version>3.0.0</jakarta.persistence-api.version>
<jakarta.persistence-api.version>3.1.0</jakarta.persistence-api.version>
<jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version>
<jakarta.transaction-api.version>2.0.1</jakarta.transaction-api.version>
<jakarta.validation-api.version>3.0.2</jakarta.validation-api.version>
Expand All @@ -97,9 +97,9 @@
<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>5.6.15.Final</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<hibernate-orm.version>6.2.0.CR2</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>5.1.2.Final</hibernate-commons-annotations.version> <!-- version controlled by Hibernate ORM -->
<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-validator.version>8.0.0.Final</hibernate-validator.version>
<hibernate-search.version>6.1.7.Final</hibernate-search.version>
Expand Down Expand Up @@ -127,7 +127,7 @@
<httpasync.version>4.1.5</httpasync.version>
<cronutils.version>9.2.0</cronutils.version>
<quartz.version>2.3.2</quartz.version>
<h2.version>2.1.214</h2.version>
<h2.version>2.1.214</h2.version> <!-- When updating, needs to be matched in io.quarkus.hibernate.orm.runtime.dialect.QuarkusH2Dialect -->
<postgresql-jdbc.version>42.5.4</postgresql-jdbc.version>
<mariadb-jdbc.version>3.1.2</mariadb-jdbc.version>
<mysql-jdbc.version>8.0.30</mysql-jdbc.version>
Expand Down Expand Up @@ -177,7 +177,7 @@
<javaparser.version>3.25.0</javaparser.version>
<okhttp.version>3.14.9</okhttp.version><!-- keep in sync with okio -->
<okio.version>1.17.2</okio.version><!-- keep in sync with okhttp -->
<hibernate-quarkus-local-cache.version>0.1.1</hibernate-quarkus-local-cache.version>
<hibernate-quarkus-local-cache.version>0.2.0</hibernate-quarkus-local-cache.version>
<flapdoodle.mongo.version>4.5.1</flapdoodle.mongo.version>
<quarkus-spring-api.version>5.2.SP7</quarkus-spring-api.version>
<quarkus-spring-data-api.version>2.1.SP2</quarkus-spring-data-api.version>
Expand Down Expand Up @@ -5367,8 +5367,8 @@
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core-jakarta</artifactId>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-orm.version}</version>
<exclusions>
<exclusion>
Expand All @@ -5378,18 +5378,18 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-graalvm</artifactId>
<version>${hibernate-orm.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers-jakarta</artifactId>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-envers</artifactId>
<version>${hibernate-orm.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen-jakarta</artifactId>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate-orm.version}</version>
</dependency>
<dependency>
Expand All @@ -5404,7 +5404,7 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>quarkus-local-cache-jakarta</artifactId>
<artifactId>quarkus-local-cache</artifactId>
<version>${hibernate-quarkus-local-cache.version}</version>
</dependency>
<dependency>
Expand All @@ -5419,18 +5419,14 @@
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-coordination-outbox-polling-jakarta</artifactId>
<artifactId>hibernate-search-mapper-orm-coordination-outbox-polling-orm6</artifactId>
<version>${hibernate-search.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-jakarta</artifactId>
<artifactId>hibernate-search-mapper-orm-orm6</artifactId>
Sanne marked this conversation as resolved.
Show resolved Hide resolved
<version>${hibernate-search.version}</version>
<exclusions>
<exclusion>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
</exclusion>
<!-- the right version will come with Hibernate ORM -->
<exclusion>
<groupId>org.hibernate.common</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.runtime.graal;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
Expand Down Expand Up @@ -41,6 +40,6 @@ public void afterAnalysis(AfterAnalysisAccess access) {

@Override
public String getDescription() {
return "Disables INFO logging during the analysis phase for the " + Arrays.toString(CATEGORIES) + " categories";
return "Disables INFO logging during the analysis phase";
}
}
8 changes: 4 additions & 4 deletions docs/src/main/asciidoc/hibernate-orm-panache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,9 @@ If your select query does not start with `from`, we support the following additi

If your update query does not start with `update`, we support the following additional forms:

- `from EntityName ...` which will expand to `update from EntityName ...`
- `set? <singleColumnName>` (and single parameter) which will expand to `update from EntityName set <singleColumnName> = ?`
- `set? <update-query>` will expand to `update from EntityName set <update-query>`
- `from EntityName ...` which will expand to `update EntityName ...`
- `set? <singleColumnName>` (and single parameter) which will expand to `update EntityName set <singleColumnName> = ?`
- `set? <update-query>` will expand to `update EntityName set <update-query>`

If your delete query does not start with `delete`, we support the following additional forms:

Expand All @@ -643,7 +643,7 @@ link:https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_Us
[source,java]
----
Order.find("select distinct o from Order o left join fetch o.lineItems");
Order.update("update from Person set name = 'Mortal' where status = ?", Status.Alive);
Order.update("update Person set name = 'Mortal' where status = ?", Status.Alive);
----

=== Named queries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
import io.quarkus.deployment.annotations.BuildSteps;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.NativeImageFeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.hibernate.envers.HibernateEnversBuildTimeConfig;
import io.quarkus.hibernate.envers.HibernateEnversBuildTimeConfigPersistenceUnit;
import io.quarkus.hibernate.envers.HibernateEnversRecorder;
import io.quarkus.hibernate.envers.runtime.graal.DisableLoggingFeature;
import io.quarkus.hibernate.orm.deployment.AdditionalJpaModelBuildItem;
import io.quarkus.hibernate.orm.deployment.PersistenceUnitDescriptorBuildItem;
import io.quarkus.hibernate.orm.deployment.integration.HibernateOrmIntegrationStaticConfiguredBuildItem;
Expand All @@ -34,17 +37,18 @@ public void registerEnversReflections(BuildProducer<ReflectiveClassBuildItem> re
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, "org.hibernate.envers.DefaultRevisionEntity"));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false,
"org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity"));
reflectiveClass
.produce(new ReflectiveClassBuildItem(false, false, "org.hibernate.tuple.entity.DynamicMapEntityTuplizer"));
reflectiveClass.produce(
new ReflectiveClassBuildItem(false, false, "org.hibernate.tuple.component.DynamicMapComponentTuplizer"));

for (HibernateEnversBuildTimeConfigPersistenceUnit pu : buildTimeConfig.getAllPersistenceUnitConfigsAsMap().values()) {
pu.revisionListener.ifPresent(s -> reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, s)));
pu.auditStrategy.ifPresent(s -> reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, s)));
}
}

@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
NativeImageFeatureBuildItem nativeImageFeature() {
return new NativeImageFeatureBuildItem(DisableLoggingFeature.class);
}

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
public void applyStaticConfig(HibernateEnversRecorder recorder, HibernateEnversBuildTimeConfig buildTimeConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import jakarta.persistence.EntityManager;
import jakarta.transaction.UserTransaction;

import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.boot.internal.EnversService;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.envers.configuration.Configuration;
import org.hibernate.envers.internal.entities.EntitiesConfigurations;
import org.hibernate.envers.strategy.AuditStrategy;
import org.hibernate.internal.SessionImpl;
import org.hibernate.persister.entity.EntityPersister;

public abstract class AbstractEnversResource {
Expand All @@ -23,23 +23,24 @@ public String getDefaultAuditEntityName(Class<?> clazz) {
}

public EntityPersister getEntityPersister(String entityName) {
return ((SessionImpl) em.getDelegate()).getSessionFactory().getMetamodel().entityPersister(entityName);
return ((SessionImplementor) em.getDelegate()).getSessionFactory().getMappingMetamodel()
.findEntityDescriptor(entityName);
}

public AuditEntitiesConfiguration getAuditEntitiesConfiguration() {
return getEnversService().getAuditEntitiesConfiguration();
public EntitiesConfigurations getEntitiesConfiguration() {
return getEnversService().getEntitiesConfigurations();
}

public GlobalConfiguration getGlobalConfiguration() {
return getEnversService().getGlobalConfiguration();
public Configuration getConfiguration() {
return getEnversService().getConfig();
}

public AuditStrategy getAuditStrategy() {
return getEnversService().getAuditStrategy();
}

public EnversService getEnversService() {
return ((((SessionImpl) em.getDelegate()).getFactory().getServiceRegistry())
return ((((SessionImplementor) em.getDelegate()).getFactory().getServiceRegistry())
.getParentServiceRegistry())
.getService(EnversService.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.envers.boot.internal.EnversService;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.Configuration;
import org.hibernate.internal.SessionFactoryImpl;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
Expand Down Expand Up @@ -36,44 +36,44 @@ public class EnversConfigurationPerPUTest {

@Test
public void testTableName() {
String generatedTableName = getAuditConfiguration(emf).getAuditTableName("entity", "table");
String generatedTableName = getConfiguration(emf).getAuditTableName("entity", "table");
assertThat(generatedTableName).isEqualTo("P_table");

generatedTableName = getAuditConfiguration(emf1).getAuditTableName("entity", "table");
generatedTableName = getConfiguration(emf1).getAuditTableName("entity", "table");
assertThat(generatedTableName).isEqualTo("T_table");

generatedTableName = getAuditConfiguration(emf2).getAuditTableName("entity", "table");
generatedTableName = getConfiguration(emf2).getAuditTableName("entity", "table");
assertThat(generatedTableName).isEqualTo("R_table");
}

@Test
public void testRevisionFieldName() {
String configuredRevisionFieldName = getAuditConfiguration(emf).getRevisionFieldName();
String configuredRevisionFieldName = getConfiguration(emf).getRevisionFieldName();
assertThat(configuredRevisionFieldName).isEqualTo("GEN");

configuredRevisionFieldName = getAuditConfiguration(emf1).getRevisionFieldName();
configuredRevisionFieldName = getConfiguration(emf1).getRevisionFieldName();
assertThat(configuredRevisionFieldName).isEqualTo("REVISION");

configuredRevisionFieldName = getAuditConfiguration(emf2).getRevisionFieldName();
configuredRevisionFieldName = getConfiguration(emf2).getRevisionFieldName();
assertThat(configuredRevisionFieldName).isEqualTo("REV");
}

@Test
public void testRevisionTypeName() {
String configuredRevisionTypeName = getAuditConfiguration(emf).getRevisionTypePropName();
String configuredRevisionTypeName = getConfiguration(emf).getRevisionTypePropertyName();
assertThat(configuredRevisionTypeName).isEqualTo("GEN_TYPE");

configuredRevisionTypeName = getAuditConfiguration(emf1).getRevisionTypePropName();
configuredRevisionTypeName = getConfiguration(emf1).getRevisionTypePropertyName();
assertThat(configuredRevisionTypeName).isEqualTo("REV_TYPE");

configuredRevisionTypeName = getAuditConfiguration(emf2).getRevisionTypePropName();
configuredRevisionTypeName = getConfiguration(emf2).getRevisionTypePropertyName();
assertThat(configuredRevisionTypeName).isEqualTo("REVTYPE");
}

private AuditEntitiesConfiguration getAuditConfiguration(EntityManagerFactory emf) {
private Configuration getConfiguration(EntityManagerFactory emf) {
return ((((SessionFactoryImplementor) emf
.unwrap(SessionFactoryImpl.class))
.getServiceRegistry()).getParentServiceRegistry())
.getService(EnversService.class).getAuditEntitiesConfiguration();
.getService(EnversService.class).getConfig();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.envers.boot.internal.EnversService;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.Configuration;
import org.hibernate.internal.SessionFactoryImpl;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
Expand All @@ -27,26 +27,26 @@ public class EnversConfigurationTest {

@Test
public void testTableName() {
String generatedTableName = getAuditConfiguration().getAuditTableName("entity", "table");
String generatedTableName = getConfiguration().getAuditTableName("entity", "table");
assertThat(generatedTableName).isEqualTo("P_table");
}

@Test
public void testRevisionFieldName() {
String configuredRevisionFieldName = getAuditConfiguration().getRevisionFieldName();
String configuredRevisionFieldName = getConfiguration().getRevisionFieldName();
assertThat(configuredRevisionFieldName).isEqualTo("GEN");
}

@Test
public void testRevisionTypeName() {
String configuredRevisionTypeName = getAuditConfiguration().getRevisionTypePropName();
String configuredRevisionTypeName = getConfiguration().getRevisionTypePropertyName();
assertThat(configuredRevisionTypeName).isEqualTo("GEN_TYPE");
}

private AuditEntitiesConfiguration getAuditConfiguration() {
private Configuration getConfiguration() {
return ((((SessionFactoryImplementor) emf
.unwrap(SessionFactoryImpl.class))
.getServiceRegistry()).getParentServiceRegistry())
.getService(EnversService.class).getAuditEntitiesConfiguration();
.getService(EnversService.class).getConfig();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.hibernate.envers.boot.internal.EnversService;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.Configuration;
import org.hibernate.internal.SessionImpl;

@Path("/audit-table-suffix")
Expand All @@ -24,9 +24,9 @@ public class EnversTestAuditTableSuffixResource {

@GET
public String getAuditTableName() {
AuditEntitiesConfiguration auditEntitiesConfiguration = ((((SessionImpl) em.getDelegate())
Configuration auditEntitiesConfiguration = ((((SessionImpl) em.getDelegate())
.getFactory().getServiceRegistry()).getParentServiceRegistry())
.getService(EnversService.class).getAuditEntitiesConfiguration();
.getService(EnversService.class).getConfig();

String calculatedAuditTableName = auditEntitiesConfiguration.getAuditTableName("entity", "table");
String expectedAuditTableName = "table" + configuredSuffix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class EnversTestAllowIdentifierReuseResource extends AbstractEnversResource {
@GET
public String getAllowIdentifierReuse() {
boolean identifierReuse = getGlobalConfiguration().isAllowIdentifierReuse();
boolean identifierReuse = getConfiguration().isAllowIdentifierReuse();
if (!identifierReuse) {
return "Expected allow_identifier_reuse to be true but was false";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
public class EnversTestDefaultSchemaCatalogResource extends AbstractEnversResource {
@GET
public String getDefaultSchemaAndCatalog() {
String defaultSchema = getGlobalConfiguration().getDefaultSchemaName();
String defaultSchema = getConfiguration().getDefaultSchemaName();
if (!"public".equals(defaultSchema)) {
return "Expected default_schema to be public but was: " + defaultSchema;
}

String defaultCatalog = getGlobalConfiguration().getDefaultCatalogName();
String defaultCatalog = getConfiguration().getDefaultCatalogName();
if (!"".equals(defaultCatalog)) {
return "Expected default_catalog to be an empty string but was: " + defaultCatalog;
}
Expand Down
Loading