From a8ac419d38944d8db2f394fea703e899e58c14d9 Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Wed, 13 Sep 2023 10:42:02 +0200 Subject: [PATCH] HSEARCH-4403 Remove payload type configuration property --- .../src/main/asciidoc/migration/index.adoc | 13 --- .../OutboxPollingCustomEntityMappingIT.java | 88 ------------------- ...bernateOrmMapperOutboxPollingSettings.java | 53 ----------- .../cfg/impl/PayloadMappingUtils.java | 31 ------- ...nateOrmMapperOutboxPollingSpiSettings.java | 6 +- ...ingAgentAdditionalJaxbMappingProducer.java | 34 ++----- ...boxEventAdditionalJaxbMappingProducer.java | 34 ++----- .../outboxpolling/logging/impl/Log.java | 6 -- 8 files changed, 13 insertions(+), 252 deletions(-) delete mode 100644 mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/impl/PayloadMappingUtils.java diff --git a/documentation/src/main/asciidoc/migration/index.adoc b/documentation/src/main/asciidoc/migration/index.adoc index 1876e539fee..811a2f20159 100644 --- a/documentation/src/main/asciidoc/migration/index.adoc +++ b/documentation/src/main/asciidoc/migration/index.adoc @@ -99,19 +99,6 @@ Other databases: * MSSQL: no migration required. Type of the `payload` is `varbinary(max)` in both cases. * H2: no migration required. Type of the `payload` is `blob` in both cases. -[NOTE] -==== -In case database migration cannot be performed immediately when upgrading to a new version of Hibernate Search, -a pair of configuration properties is available: -[source] ----- -hibernate.search.coordination.entity.mapping.agent.payload_type=materialized_blob -hibernate.search.coordination.entity.mapping.outboxevent.payload_type=materialized_blob ----- -Keep in mind that these properties are temporary, to help with the migration, -and will be removed in the future versions of Hibernate Search. -==== - If you were using Hibernate Search 6.2 with Hibernate ORM 5, i.e. using regular Hibernate Search artifacts and not `-orm6`/`-jakarta` ones this upgrade will also mean the upgrade of Hibernate ORM to 6.3. Doing so will lead to a potential type mismatch when using Hibernate ORM's schema validation. To prevent that, `id` column types can be updated from `varchar` to `char` where applicable. diff --git a/integrationtest/mapper/orm-coordination-outbox-polling/src/test/java/org/hibernate/search/integrationtest/mapper/orm/coordination/outboxpolling/schema/OutboxPollingCustomEntityMappingIT.java b/integrationtest/mapper/orm-coordination-outbox-polling/src/test/java/org/hibernate/search/integrationtest/mapper/orm/coordination/outboxpolling/schema/OutboxPollingCustomEntityMappingIT.java index b5d91f0d8fe..d28b39d1ab4 100644 --- a/integrationtest/mapper/orm-coordination-outbox-polling/src/test/java/org/hibernate/search/integrationtest/mapper/orm/coordination/outboxpolling/schema/OutboxPollingCustomEntityMappingIT.java +++ b/integrationtest/mapper/orm-coordination-outbox-polling/src/test/java/org/hibernate/search/integrationtest/mapper/orm/coordination/outboxpolling/schema/OutboxPollingCustomEntityMappingIT.java @@ -33,7 +33,6 @@ import org.hibernate.search.integrationtest.mapper.orm.coordination.outboxpolling.testsupport.util.TestingOutboxPollingInternalConfigurer; import org.hibernate.search.mapper.orm.coordination.outboxpolling.avro.impl.EventPayloadSerializationUtils; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.HibernateOrmMapperOutboxPollingSettings; -import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.PayloadType; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.impl.HibernateOrmMapperOutboxPollingImplSettings; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cluster.impl.Agent; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cluster.impl.OutboxPollingAgentAdditionalJaxbMappingProducer; @@ -51,8 +50,6 @@ import org.junit.Rule; import org.junit.Test; -import org.apache.logging.log4j.Level; - public class OutboxPollingCustomEntityMappingIT { private static final String CUSTOM_SCHEMA = "CUSTOM_SCHEMA"; @@ -392,91 +389,6 @@ public void validMappingWithCustomFailingUuidGenerator() { ); } - @Test - public void validMappingWithDefaultPayloadType() { - testPayloadType( null ); - } - - @Test - public void validMappingWithExplicitDefaultPayloadType() { - testPayloadType( PayloadType.LONG32VARBINARY ); - } - - @Test - @SuppressWarnings("deprecation") - public void validMappingWithNonDefaultPayloadType() { - testPayloadType( PayloadType.MATERIALIZED_BLOB ); - } - - @SuppressWarnings("deprecation") - private void testPayloadType(PayloadType payloadType) { - KeysStatementInspector statementInspector = new KeysStatementInspector(); - - backendMock.expectAnySchema( IndexedEntity.INDEX ); - OrmSetupHelper.SetupContext setupContext = ormSetupHelper.start() - .withProperty( - HibernateOrmMapperOutboxPollingImplSettings.COORDINATION_INTERNAL_CONFIGURER, - new TestingOutboxPollingInternalConfigurer().outboxEventFilter( eventFilter ) - ) - // Allow ORM to create schema as we want to use non-default for this testcase: - .withProperty( "jakarta.persistence.create-database-schemas", true ) - .withProperty( "hibernate.show_sql", true ) - .withProperty( "hibernate.format_sql", true ) - .withProperty( "hibernate.session_factory.statement_inspector", statementInspector ); - - if ( payloadType != null ) { - setupContext - .withProperty( - HibernateOrmMapperOutboxPollingSettings.COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE, - payloadType - ) - .withProperty( - HibernateOrmMapperOutboxPollingSettings.COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE, - payloadType - ); - logged.expectEvent( - Level.WARN, - "Configuration property `hibernate.search.coordination.entity.mapping.outboxevent.payload_type` is deprecated and will be removed in the future versions of Hibernate Search", - "This property is only to help with the schema migration and should not be used as a long term solution" - ); - logged.expectEvent( - Level.WARN, - "Configuration property `hibernate.search.coordination.entity.mapping.agent.payload_type` is deprecated and will be removed in the future versions of Hibernate Search", - "This property is only to help with the schema migration and should not be used as a long term solution" - ); - } - sessionFactory = setupContext.setup( IndexedEntity.class ); - - backendMock.verifyExpectationsMet(); - - int id = 1; - with( sessionFactory ).runInTransaction( session -> { - IndexedEntity entity = new IndexedEntity(); - entity.setId( id ); - entity.setIndexedField( "value for the field" ); - session.persist( entity ); - - backendMock.expectWorks( IndexedEntity.INDEX ) - .add( "1", f -> f.field( "indexedField", "value for the field" ) ); - } ); - - await().untilAsserted( () -> { - with( sessionFactory ).runInTransaction( session -> { - assertEventPayload( session ); - assertAgentPayload( session ); - } ); - } ); - // The events were hidden until now, to ensure they were not processed in separate batches. - // Make them visible to Hibernate Search now. - eventFilter.showAllEventsUpToNow( sessionFactory ); - eventFilter.awaitUntilNoMoreVisibleEvents( sessionFactory ); - - backendMock.verifyExpectationsMet(); - - assertThat( statementInspector.countByKey( ORIGINAL_OUTBOX_EVENT_TABLE_NAME ) ).isPositive(); - assertThat( statementInspector.countByKey( ORIGINAL_AGENT_TABLE_NAME ) ).isPositive(); - } - private void assertEventUUIDVersion(Session session, int expectedVersion) { List events = eventFilter.findOutboxEventsNoFilter( session ); assertThat( events ) diff --git a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/HibernateOrmMapperOutboxPollingSettings.java b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/HibernateOrmMapperOutboxPollingSettings.java index a3a7ce39ef5..8619b2d84b3 100644 --- a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/HibernateOrmMapperOutboxPollingSettings.java +++ b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/HibernateOrmMapperOutboxPollingSettings.java @@ -428,25 +428,6 @@ private HibernateOrmMapperOutboxPollingSettings() { public static final String COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE = PREFIX + Radicals.COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE; - /** - * The name of the {@link org.hibernate.type.SqlTypes SQL type} used for representing the payload in the outbox event table. - *

- * Supported values are: - *

- * Only available when {@value HibernateOrmMapperSettings#COORDINATION_STRATEGY} is - * {@value HibernateOrmMapperOutboxPollingSettings#COORDINATION_STRATEGY_NAME}. - *

- * The default value is {@link Defaults#COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE}. - * @deprecated The setting is only available to help migrate existing applications to the current version of Hibernate Search. - * This setting will be removed in the future releases. - */ - @Deprecated - public static final String COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE = - PREFIX + Radicals.COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE; - /** * The database catalog to use for the agent table. *

@@ -507,26 +488,6 @@ private HibernateOrmMapperOutboxPollingSettings() { public static final String COORDINATION_ENTITY_MAPPING_AGENT_UUID_TYPE = PREFIX + Radicals.COORDINATION_ENTITY_MAPPING_AGENT_UUID_TYPE; - /** - * The name of the {@link org.hibernate.type.SqlTypes SQL type} used for representing the payload in the agent table. - *

- * Supported values are: - *

- * Only available when {@value HibernateOrmMapperSettings#COORDINATION_STRATEGY} is - * {@value HibernateOrmMapperOutboxPollingSettings#COORDINATION_STRATEGY_NAME}. - *

- * The default value is {@link Defaults#COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE}. - * @deprecated The setting is only available to help migrate existing applications to the current version of Hibernate Search. - * This setting will be removed in the future releases. - */ - @Deprecated - public static final String COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE = - PREFIX + Radicals.COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE; - - /** * Configuration property keys without the {@link #PREFIX prefix}. */ @@ -573,9 +534,6 @@ private Radicals() { COORDINATION_PREFIX + CoordinationRadicals.ENTITY_MAPPING_OUTBOXEVENT_UUID_GEN_STRATEGY; public static final String COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE = COORDINATION_PREFIX + CoordinationRadicals.ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE; - @Deprecated - public static final String COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE = - COORDINATION_PREFIX + CoordinationRadicals.ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE; public static final String COORDINATION_ENTITY_MAPPING_AGENT_CATALOG = COORDINATION_PREFIX + CoordinationRadicals.ENTITY_MAPPING_AGENT_CATALOG; public static final String COORDINATION_ENTITY_MAPPING_AGENT_SCHEMA = @@ -586,9 +544,6 @@ private Radicals() { COORDINATION_PREFIX + CoordinationRadicals.ENTITY_MAPPING_AGENT_UUID_GEN_STRATEGY; public static final String COORDINATION_ENTITY_MAPPING_AGENT_UUID_TYPE = COORDINATION_PREFIX + CoordinationRadicals.ENTITY_MAPPING_AGENT_UUID_TYPE; - @Deprecated - public static final String COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE = - COORDINATION_PREFIX + CoordinationRadicals.ENTITY_MAPPING_AGENT_PAYLOAD_TYPE; } /** @@ -623,8 +578,6 @@ private CoordinationRadicals() { public static final String ENTITY_MAPPING_AGENT_CATALOG = ENTITY_MAPPING_AGENT_PREFIX + "catalog"; public static final String ENTITY_MAPPING_AGENT_UUID_GEN_STRATEGY = ENTITY_MAPPING_AGENT_PREFIX + "uuid_gen_strategy"; public static final String ENTITY_MAPPING_AGENT_UUID_TYPE = ENTITY_MAPPING_AGENT_PREFIX + "uuid_type"; - @Deprecated - public static final String ENTITY_MAPPING_AGENT_PAYLOAD_TYPE = ENTITY_MAPPING_AGENT_PREFIX + "payload_type"; public static final String ENTITY_MAPPING_OUTBOXEVENT_PREFIX = ENTITY_MAPPING_PREFIX + "outboxevent."; public static final String ENTITY_MAPPING_OUTBOXEVENT_TABLE = ENTITY_MAPPING_OUTBOXEVENT_PREFIX + "table"; public static final String ENTITY_MAPPING_OUTBOXEVENT_SCHEMA = ENTITY_MAPPING_OUTBOXEVENT_PREFIX + "schema"; @@ -632,8 +585,6 @@ private CoordinationRadicals() { public static final String ENTITY_MAPPING_OUTBOXEVENT_UUID_GEN_STRATEGY = ENTITY_MAPPING_OUTBOXEVENT_PREFIX + "uuid_gen_strategy"; public static final String ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE = ENTITY_MAPPING_OUTBOXEVENT_PREFIX + "uuid_type"; - @Deprecated - public static final String ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE = ENTITY_MAPPING_OUTBOXEVENT_PREFIX + "payload_type"; } /** @@ -664,16 +615,12 @@ private Defaults() { public static final UuidGenerationStrategy COORDINATION_ENTITY_MAPPING_AGENT_UUID_GEN_STRATEGY = UuidGenerationStrategy.AUTO; public static final String COORDINATION_ENTITY_MAPPING_AGENT_UUID_TYPE = "default"; - @Deprecated - public static final PayloadType COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE = PayloadType.LONG32VARBINARY; // Must not be longer than 20 characters, so that the generator does not exceed the 30 characters for Oracle11g public static final String COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_TABLE = HSEARCH_PREFIX + "OUTBOX_EVENT"; public static final UuidGenerationStrategy COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_UUID_GEN_STRATEGY = UuidGenerationStrategy.AUTO; public static final String COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_UUID_TYPE = "default"; - @Deprecated - public static final PayloadType COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_PAYLOAD_TYPE = PayloadType.LONG32VARBINARY; } /** diff --git a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/impl/PayloadMappingUtils.java b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/impl/PayloadMappingUtils.java deleted file mode 100644 index cb3a6acf6fb..00000000000 --- a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/impl/PayloadMappingUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Hibernate Search, full-text search for your domain model - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.impl; - -import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.PayloadType; -import org.hibernate.search.util.common.AssertionFailure; -import org.hibernate.type.SqlTypes; - -public final class PayloadMappingUtils { - private PayloadMappingUtils() { - } - - @SuppressWarnings("deprecation") - public static int payload(PayloadType type) { - switch ( type ) { - case MATERIALIZED_BLOB: - return SqlTypes.MATERIALIZED_BLOB; - case LONG32VARBINARY: - // TODO: check with Yoann - // note it's not the `LONG32VARBINARY` ... Postgres driver doesn't know about such type and simply fails - // to process events ... - return SqlTypes.LONGVARBINARY; - default: - throw new AssertionFailure( "Unsupported PayloadType: " + type ); - } - } -} diff --git a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/spi/HibernateOrmMapperOutboxPollingSpiSettings.java b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/spi/HibernateOrmMapperOutboxPollingSpiSettings.java index c56e95fcd46..80a26df23b0 100644 --- a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/spi/HibernateOrmMapperOutboxPollingSpiSettings.java +++ b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cfg/spi/HibernateOrmMapperOutboxPollingSpiSettings.java @@ -43,8 +43,7 @@ private HibernateOrmMapperOutboxPollingSpiSettings() { * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_SCHEMA}, * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_TABLE}, * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_UUID_GEN_STRATEGY}, - * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE}, - * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE}. + * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE}. * An exception ({@link org.hibernate.search.util.common.SearchException} will be thrown in case of such misconfiguration. */ public static final String OUTBOXEVENT_ENTITY_MAPPING = PREFIX + Radicals.OUTBOXEVENT_ENTITY_MAPPING; @@ -65,8 +64,7 @@ private HibernateOrmMapperOutboxPollingSpiSettings() { * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_AGENT_SCHEMA}, * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_AGENT_TABLE}, * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_AGENT_UUID_GEN_STRATEGY}, - * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_AGENT_UUID_TYPE}, - * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE}. + * {@link HibernateOrmMapperOutboxPollingSettings#COORDINATION_ENTITY_MAPPING_AGENT_UUID_TYPE}. * An exception ({@link org.hibernate.search.util.common.SearchException} will be thrown in case of such misconfiguration. */ public static final String AGENT_ENTITY_MAPPING = PREFIX + Radicals.AGENT_ENTITY_MAPPING; diff --git a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cluster/impl/OutboxPollingAgentAdditionalJaxbMappingProducer.java b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cluster/impl/OutboxPollingAgentAdditionalJaxbMappingProducer.java index 068160cec96..6b52e760a9e 100644 --- a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cluster/impl/OutboxPollingAgentAdditionalJaxbMappingProducer.java +++ b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/cluster/impl/OutboxPollingAgentAdditionalJaxbMappingProducer.java @@ -23,9 +23,7 @@ import org.hibernate.search.engine.cfg.spi.OptionalConfigurationProperty; import org.hibernate.search.mapper.orm.bootstrap.spi.HibernateSearchOrmMappingProducer; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.HibernateOrmMapperOutboxPollingSettings; -import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.PayloadType; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.UuidGenerationStrategy; -import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.impl.PayloadMappingUtils; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.impl.UuidDataTypeUtils; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.spi.HibernateOrmMapperOutboxPollingSpiSettings; import org.hibernate.search.mapper.orm.coordination.outboxpolling.logging.impl.Log; @@ -49,8 +47,7 @@ public class OutboxPollingAgentAdditionalJaxbMappingProducer implements Hibernat @SuppressWarnings("deprecation") public static final String ENTITY_DEFINITION = marshall( createMappings( "", "", HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_AGENT_TABLE, - SqlTypes.CHAR, PayloadMappingUtils.payload( - HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE ), + SqlTypes.CHAR, HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_AGENT_UUID_GEN_STRATEGY.strategy(), false ) ); @@ -91,13 +88,6 @@ public class OutboxPollingAgentAdditionalJaxbMappingProducer implements Hibernat .asString() .build(); - @SuppressWarnings("deprecation") - private static final OptionalConfigurationProperty ENTITY_MAPPING_AGENT_PAYLOAD_TYPE = - ConfigurationProperty.forKey( - HibernateOrmMapperOutboxPollingSettings.CoordinationRadicals.ENTITY_MAPPING_AGENT_PAYLOAD_TYPE ) - .as( PayloadType.class, PayloadType::of ) - .build(); - @Override public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySource propertySource, Dialect dialect, MetadataBuildingContext buildingContext) { @@ -114,13 +104,11 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo ENTITY_MAPPING_AGENT_UUID_TYPE, dialect ) ); - Optional payloadType = ENTITY_MAPPING_AGENT_PAYLOAD_TYPE.get( propertySource ); // only allow configuring the entire mapping or table/catalog/schema/generator/datatype names if ( mapping.isPresent() && ( schema.isPresent() - || catalog.isPresent() || table.isPresent() || uuidStrategy.isPresent() || uuidType.isPresent() - || payloadType.isPresent() ) ) { + || catalog.isPresent() || table.isPresent() || uuidStrategy.isPresent() || uuidType.isPresent() ) ) { throw log.agentConfigurationPropertyConflict( AGENT_ENTITY_MAPPING.resolveOrRaw( propertySource ), new String[] { @@ -128,15 +116,10 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo ENTITY_MAPPING_AGENT_CATALOG.resolveOrRaw( propertySource ), ENTITY_MAPPING_AGENT_TABLE.resolveOrRaw( propertySource ), ENTITY_MAPPING_AGENT_UUID_GEN_STRATEGY.resolveOrRaw( propertySource ), - ENTITY_MAPPING_AGENT_UUID_TYPE.resolveOrRaw( propertySource ), - ENTITY_MAPPING_AGENT_PAYLOAD_TYPE.resolveOrRaw( propertySource ) + ENTITY_MAPPING_AGENT_UUID_TYPE.resolveOrRaw( propertySource ) } ); } - if ( payloadType.isPresent() ) { - log.usingDeprecatedPayloadTypeConfigurationProperty( - ENTITY_MAPPING_AGENT_PAYLOAD_TYPE.resolveOrRaw( propertySource ) ); - } JaxbEntityMappings mappings; if ( mapping.isPresent() ) { @@ -144,11 +127,6 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo } else { int resolvedUuidType = uuidType.orElseGet( () -> UuidDataTypeUtils.defaultUuidType( dialect ) ); - @SuppressWarnings("deprecation") - int resolvedPayloadType = PayloadMappingUtils.payload( - payloadType.orElse( - HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_AGENT_PAYLOAD_TYPE ) - ); String resolvedUuidStrategy = uuidStrategy.orElse( HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_AGENT_UUID_GEN_STRATEGY ) .strategy(); @@ -157,7 +135,7 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo schema.orElse( "" ), catalog.orElse( "" ), table.orElse( HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_AGENT_TABLE ), - resolvedUuidType, resolvedPayloadType, resolvedUuidStrategy, + resolvedUuidType, resolvedUuidStrategy, isDiscriminatorMultiTenancyEnabled( buildingContext ) ); } @@ -168,7 +146,7 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo } private static JaxbEntityMappings createMappings(String schema, String catalog, - String table, int resolvedUuidType, int resolvedPayloadType, String resolvedUuidStrategy, + String table, int resolvedUuidType, String resolvedUuidStrategy, boolean tenantIdRequired) { AdditionalMappingBuilder builder = new AdditionalMappingBuilder( Agent.class, ENTITY_NAME ) @@ -180,7 +158,7 @@ private static JaxbEntityMappings createMappings(String schema, String catalog, .enumAttribute( "state", null, false ) .attribute( "totalShardCount", null, true ) .attribute( "assignedShardIndex", null, true ) - .attribute( "payload", Length.LONG32, true, resolvedPayloadType ); + .attribute( "payload", Length.LONG32, true ); if ( tenantIdRequired ) { builder.tenantId( "tenantId" ); } diff --git a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/event/impl/OutboxPollingOutboxEventAdditionalJaxbMappingProducer.java b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/event/impl/OutboxPollingOutboxEventAdditionalJaxbMappingProducer.java index fe0946f1b3b..a49e902eea4 100644 --- a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/event/impl/OutboxPollingOutboxEventAdditionalJaxbMappingProducer.java +++ b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/event/impl/OutboxPollingOutboxEventAdditionalJaxbMappingProducer.java @@ -22,9 +22,7 @@ import org.hibernate.search.engine.cfg.spi.OptionalConfigurationProperty; import org.hibernate.search.mapper.orm.bootstrap.spi.HibernateSearchOrmMappingProducer; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.HibernateOrmMapperOutboxPollingSettings; -import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.PayloadType; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.UuidGenerationStrategy; -import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.impl.PayloadMappingUtils; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.impl.UuidDataTypeUtils; import org.hibernate.search.mapper.orm.coordination.outboxpolling.cfg.spi.HibernateOrmMapperOutboxPollingSpiSettings; import org.hibernate.search.mapper.orm.coordination.outboxpolling.logging.impl.Log; @@ -47,12 +45,9 @@ public final class OutboxPollingOutboxEventAdditionalJaxbMappingProducer // because our override actually matches the default for the native entity name. public static final String ENTITY_NAME = CLASS_NAME; - @SuppressWarnings("deprecation") public static final String ENTITY_DEFINITION = marshall( createMappings( "", "", HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_TABLE, SqlTypes.CHAR, - PayloadMappingUtils.payload( - HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_PAYLOAD_TYPE ), HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_UUID_GEN_STRATEGY .strategy(), false @@ -94,13 +89,6 @@ public final class OutboxPollingOutboxEventAdditionalJaxbMappingProducer .asString() .build(); - @SuppressWarnings("deprecation") - private static final OptionalConfigurationProperty ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE = - ConfigurationProperty.forKey( - HibernateOrmMapperOutboxPollingSettings.CoordinationRadicals.ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE ) - .as( PayloadType.class, PayloadType::of ) - .build(); - @Override public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySource propertySource, Dialect dialect, @@ -118,12 +106,10 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE, dialect ) ); - Optional payloadType = ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE.get( propertySource ); if ( mapping.isPresent() && ( schema.isPresent() - || catalog.isPresent() || table.isPresent() || uuidStrategy.isPresent() || uuidType.isPresent() - || payloadType.isPresent() ) ) { + || catalog.isPresent() || table.isPresent() || uuidStrategy.isPresent() || uuidType.isPresent() ) ) { throw log.outboxEventConfigurationPropertyConflict( OUTBOXEVENT_ENTITY_MAPPING.resolveOrRaw( propertySource ), @@ -132,15 +118,10 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo ENTITY_MAPPING_OUTBOXEVENT_CATALOG.resolveOrRaw( propertySource ), ENTITY_MAPPING_OUTBOXEVENT_TABLE.resolveOrRaw( propertySource ), ENTITY_MAPPING_OUTBOXEVENT_UUID_GEN_STRATEGY.resolveOrRaw( propertySource ), - ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE.resolveOrRaw( propertySource ), - ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE.resolveOrRaw( propertySource ) + ENTITY_MAPPING_OUTBOXEVENT_UUID_TYPE.resolveOrRaw( propertySource ) } ); } - if ( payloadType.isPresent() ) { - log.usingDeprecatedPayloadTypeConfigurationProperty( - ENTITY_MAPPING_OUTBOXEVENT_PAYLOAD_TYPE.resolveOrRaw( propertySource ) ); - } JaxbEntityMappings mappings; if ( mapping.isPresent() ) { @@ -148,11 +129,6 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo } else { int resolvedUuidType = uuidType.orElseGet( () -> UuidDataTypeUtils.defaultUuidType( dialect ) ); - @SuppressWarnings("deprecation") - int resolvedPayloadType = PayloadMappingUtils.payload( - payloadType.orElse( - HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_PAYLOAD_TYPE ) - ); String resolvedUuidStrategy = uuidStrategy.orElse( HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_UUID_GEN_STRATEGY ) .strategy(); @@ -161,7 +137,7 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo catalog.orElse( "" ), table.orElse( HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_OUTBOX_EVENT_TABLE ), - resolvedUuidType, resolvedPayloadType, resolvedUuidStrategy, + resolvedUuidType, resolvedUuidStrategy, isDiscriminatorMultiTenancyEnabled( buildingContext ) ); } @@ -172,7 +148,7 @@ public Map, JaxbEntityMappings> produceMappings(ConfigurationPropertySo } private static JaxbEntityMappings createMappings(String schema, String catalog, - String table, int resolvedUuidType, int resolvedPayloadType, String resolvedUuidStrategy, + String table, int resolvedUuidType, String resolvedUuidStrategy, boolean tenantIdRequired) { AdditionalMappingBuilder builder = new AdditionalMappingBuilder( OutboxEvent.class, ENTITY_NAME ) @@ -184,7 +160,7 @@ private static JaxbEntityMappings createMappings(String schema, String catalog, .attribute( "entityName", 256, false ) .attribute( "entityId", 256, false ) .attribute( "entityIdHash", null, false ) - .attribute( "payload", Length.LONG32, false, resolvedPayloadType ) + .attribute( "payload", Length.LONG32, false ) .attribute( "retries", null, false ) .attribute( "processAfter", null, false ) .enumAttribute( "status", null, false ); diff --git a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/logging/impl/Log.java b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/logging/impl/Log.java index 91b76d3639b..5829b1b0938 100644 --- a/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/logging/impl/Log.java +++ b/mapper/orm-coordination-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/coordination/outboxpolling/logging/impl/Log.java @@ -199,12 +199,6 @@ void startingOutboxMassIndexerAgent(String name, + " Valid names are: %2$s.") SearchException invalidPayloadTypeName(String name, List values); - @LogMessage(level = WARN) - @Message(id = ID_OFFSET + 33, - value = "Configuration property `%1$s` is deprecated and will be removed in the future versions of Hibernate Search." - + " This property is only to help with the schema migration and should not be used as a long term solution.") - void usingDeprecatedPayloadTypeConfigurationProperty(String configurationProperty); - @LogMessage(level = DEBUG) @Message(id = ID_OFFSET + 34, // Warning: we check that this message does NOT appear in logs in some tests.