Skip to content

Commit 511c5d0

Browse files
yrodieremarko-bekhta
authored andcommitted
HSEARCH-5082 Upgrade to Hibernate ORM 7.0
1 parent f96deea commit 511c5d0

File tree

18 files changed

+127
-70
lines changed

18 files changed

+127
-70
lines changed

backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/search/query/impl/ElasticsearchSearchQueryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ private URLEncodedString toElasticsearchId(ElasticsearchSearchIndexContext index
297297
}
298298

299299
@Override
300-
public void failAfter(long timeout, TimeUnit timeUnit) {
300+
public void failAfter(Long timeout, TimeUnit timeUnit) {
301301
// replace the timeout manager on already created query instance
302302
timeoutManager = scope.createTimeoutManager( timeout, timeUnit, true );
303303
}

backend/lucene/src/main/java/org/hibernate/search/backend/lucene/search/query/impl/LuceneSearchQueryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public Sort luceneSort() {
164164
}
165165

166166
@Override
167-
public void failAfter(long timeout, TimeUnit timeUnit) {
167+
public void failAfter(Long timeout, TimeUnit timeUnit) {
168168
// replace the timeout manager on already created query instance
169169
timeoutManager = scope.createTimeoutManager( timeout, timeUnit, true );
170170
searcher.setTimeoutManager( timeoutManager );

build/parents/build/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
NOTE: when Hibernate ORM updates Byte Buddy, make sure to check Jenkinsfile to see if
9898
`net.bytebuddy.experimental` property can be removed.
9999
-->
100-
<version.org.hibernate.orm>6.5.0.Final</version.org.hibernate.orm>
100+
<version.org.hibernate.orm>7.0.0-SNAPSHOT</version.org.hibernate.orm>
101101

102102
<javadoc.org.hibernate.orm.url>https://docs.jboss.org/hibernate/orm/${parsed-version.org.hibernate.orm.majorVersion}.${parsed-version.org.hibernate.orm.minorVersion}/javadocs/</javadoc.org.hibernate.orm.url>
103103
<documentation.org.hibernate.orm.url>https://docs.jboss.org/hibernate/orm/${parsed-version.org.hibernate.orm.majorVersion}.${parsed-version.org.hibernate.orm.minorVersion}/userguide/html_single/Hibernate_User_Guide.html</documentation.org.hibernate.orm.url>
@@ -113,7 +113,7 @@
113113
Even though we are importing the Hibernate ORM BOM where Jakarta Persistence is managed, we don't have easy access
114114
to its version. We need a version to be able to display it in the docs. This property is exactly to address that need.
115115
-->
116-
<version.jakarta.persistence>3.1.0</version.jakarta.persistence>
116+
<version.jakarta.persistence>3.2.0-M2</version.jakarta.persistence>
117117

118118
<!-- >>> Jakarta Batch -->
119119
<version.jakarta.batch>2.1.1</version.jakarta.batch>

engine/src/main/java/org/hibernate/search/engine/search/query/spi/SearchQueryImplementor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@
2020
*/
2121
public interface SearchQueryImplementor<H> extends SearchQuery<H> {
2222

23-
void failAfter(long timeout, TimeUnit timeUnit);
23+
@Deprecated
24+
default void failAfter(long timeout, TimeUnit timeUnit) {
25+
failAfter( (Long) timeout, timeUnit );
26+
}
27+
28+
void failAfter(Long timeout, TimeUnit timeUnit);
2429
}

mapper/orm-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/outboxpolling/cluster/impl/OutboxPollingAgentAdditionalJaxbMappingProducer.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import java.util.Optional;
1212

1313
import org.hibernate.Length;
14-
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
14+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
1515
import org.hibernate.boot.spi.MetadataBuildingContext;
1616
import org.hibernate.search.engine.cfg.ConfigurationPropertySource;
1717
import org.hibernate.search.engine.cfg.spi.ConfigurationProperty;
@@ -41,7 +41,6 @@ public class OutboxPollingAgentAdditionalJaxbMappingProducer implements Hibernat
4141
// because our override actually matches the default for the native entity name.
4242
public static final String ENTITY_NAME = CLASS_NAME;
4343

44-
@SuppressWarnings("deprecation")
4544
public static final String ENTITY_DEFINITION = JaxbMappingHelper.marshall( createMappings( "", "",
4645
HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_ENTITY_MAPPING_AGENT_TABLE,
4746
SqlTypes.CHAR,
@@ -86,7 +85,7 @@ public class OutboxPollingAgentAdditionalJaxbMappingProducer implements Hibernat
8685
.build();
8786

8887
@Override
89-
public Map<Class<?>, JaxbEntityMappings> produceMappings(ConfigurationPropertySource propertySource,
88+
public Map<Class<?>, JaxbEntityMappingsImpl> produceMappings(ConfigurationPropertySource propertySource,
9089
MetadataBuildingContext buildingContext) {
9190
Optional<String> mapping = AGENT_ENTITY_MAPPING.get( propertySource );
9291
Optional<String> schema = ENTITY_MAPPING_AGENT_SCHEMA.get( propertySource );
@@ -117,7 +116,7 @@ public Map<Class<?>, JaxbEntityMappings> produceMappings(ConfigurationPropertySo
117116
);
118117
}
119118

120-
JaxbEntityMappings mappings;
119+
JaxbEntityMappingsImpl mappings;
121120
if ( mapping.isPresent() ) {
122121
mappings = JaxbMappingHelper.unmarshall( mapping.get() );
123122
}
@@ -141,7 +140,7 @@ public Map<Class<?>, JaxbEntityMappings> produceMappings(ConfigurationPropertySo
141140
return Map.of( Agent.class, mappings );
142141
}
143142

144-
private static JaxbEntityMappings createMappings(String schema, String catalog,
143+
private static JaxbEntityMappingsImpl createMappings(String schema, String catalog,
145144
String table, Integer resolvedUuidType, String resolvedUuidStrategy,
146145
boolean tenantIdRequired) {
147146
AdditionalMappingBuilder builder = new AdditionalMappingBuilder(

mapper/orm-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/outboxpolling/event/impl/OutboxPollingOutboxEventAdditionalJaxbMappingProducer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import java.util.Optional;
1212

1313
import org.hibernate.Length;
14-
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
14+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
1515
import org.hibernate.boot.spi.MetadataBuildingContext;
1616
import org.hibernate.search.engine.cfg.ConfigurationPropertySource;
1717
import org.hibernate.search.engine.cfg.spi.ConfigurationProperty;
@@ -88,7 +88,7 @@ public final class OutboxPollingOutboxEventAdditionalJaxbMappingProducer
8888

8989

9090
@Override
91-
public Map<Class<?>, JaxbEntityMappings> produceMappings(ConfigurationPropertySource propertySource,
91+
public Map<Class<?>, JaxbEntityMappingsImpl> produceMappings(ConfigurationPropertySource propertySource,
9292
MetadataBuildingContext buildingContext) {
9393
Optional<String> mapping = OUTBOXEVENT_ENTITY_MAPPING.get( propertySource );
9494
Optional<String> schema = ENTITY_MAPPING_OUTBOXEVENT_SCHEMA.get( propertySource );
@@ -119,7 +119,7 @@ public Map<Class<?>, JaxbEntityMappings> produceMappings(ConfigurationPropertySo
119119
);
120120
}
121121

122-
JaxbEntityMappings mappings;
122+
JaxbEntityMappingsImpl mappings;
123123
if ( mapping.isPresent() ) {
124124
mappings = JaxbMappingHelper.unmarshall( mapping.get() );
125125
}
@@ -143,7 +143,7 @@ public Map<Class<?>, JaxbEntityMappings> produceMappings(ConfigurationPropertySo
143143
return Map.of( OutboxEvent.class, mappings );
144144
}
145145

146-
private static JaxbEntityMappings createMappings(String schema, String catalog,
146+
private static JaxbEntityMappingsImpl createMappings(String schema, String catalog,
147147
String table, Integer resolvedUuidType, String resolvedUuidStrategy,
148148
boolean tenantIdRequired) {
149149
AdditionalMappingBuilder builder = new AdditionalMappingBuilder(

mapper/orm-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/outboxpolling/logging/impl/JaxbEntityMappingsFormatter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
*/
77
package org.hibernate.search.mapper.orm.outboxpolling.logging.impl;
88

9-
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
9+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
1010
import org.hibernate.search.mapper.orm.outboxpolling.mapping.impl.JaxbMappingHelper;
1111

1212
/**
1313
* Used with JBoss Logging's {@link org.jboss.logging.annotations.FormatWith} to format
14-
* {@link JaxbEntityMappings} objects using marshaling.
14+
* {@link JaxbEntityMappingsImpl} objects using marshaling.
1515
*/
1616
public final class JaxbEntityMappingsFormatter {
1717

18-
private final JaxbEntityMappings mappings;
18+
private final JaxbEntityMappingsImpl mappings;
1919

20-
public JaxbEntityMappingsFormatter(JaxbEntityMappings mappings) {
20+
public JaxbEntityMappingsFormatter(JaxbEntityMappingsImpl mappings) {
2121
this.mappings = mappings;
2222
}
2323

mapper/orm-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/outboxpolling/logging/impl/Log.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import jakarta.persistence.PersistenceException;
1919

20-
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
20+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
2121
import org.hibernate.search.mapper.orm.outboxpolling.cluster.impl.Agent;
2222
import org.hibernate.search.mapper.orm.outboxpolling.cluster.impl.AgentReference;
2323
import org.hibernate.search.mapper.orm.outboxpolling.cluster.impl.ShardAssignmentDescriptor;
@@ -47,7 +47,7 @@ public interface Log extends BasicLogger {
4747
@LogMessage(level = DEBUG)
4848
@Message(id = ID_OFFSET + 1,
4949
value = "Generated entity mapping for outbox events used in the outbox-polling coordination strategy: %1$s")
50-
void outboxEventGeneratedEntityMapping(@FormatWith(JaxbEntityMappingsFormatter.class) JaxbEntityMappings mappings);
50+
void outboxEventGeneratedEntityMapping(@FormatWith(JaxbEntityMappingsFormatter.class) JaxbEntityMappingsImpl mappings);
5151

5252
@Message(id = ID_OFFSET + 3, value = "Max '%1$s' retries exhausted to process the event. Event will be aborted.")
5353
SearchException maxRetryExhausted(int retries);
@@ -98,7 +98,8 @@ void startingOutboxEventProcessor(String name,
9898
@LogMessage(level = DEBUG)
9999
@Message(id = ID_OFFSET + 14,
100100
value = "Generated entity mapping for agents used in the outbox-polling coordination strategy: %1$s")
101-
void agentGeneratedEntityMapping(@FormatWith(JaxbEntityMappingsFormatter.class) JaxbEntityMappings xmlMappingDefinition);
101+
void agentGeneratedEntityMapping(
102+
@FormatWith(JaxbEntityMappingsFormatter.class) JaxbEntityMappingsImpl xmlMappingDefinition);
102103

103104
@Message(id = ID_OFFSET + 15, value = "The pulse interval must be greater than or equal to the polling interval"
104105
+ " i.e. in this case at least %s")

mapper/orm-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/outboxpolling/mapping/impl/AdditionalMappingBuilder.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@
1212
import jakarta.persistence.EnumType;
1313

1414
import org.hibernate.annotations.UuidGenerator;
15-
import org.hibernate.boot.jaxb.mapping.JaxbAttributes;
16-
import org.hibernate.boot.jaxb.mapping.JaxbBasic;
17-
import org.hibernate.boot.jaxb.mapping.JaxbColumn;
18-
import org.hibernate.boot.jaxb.mapping.JaxbEntity;
19-
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
20-
import org.hibernate.boot.jaxb.mapping.JaxbId;
21-
import org.hibernate.boot.jaxb.mapping.JaxbIndex;
22-
import org.hibernate.boot.jaxb.mapping.JaxbTable;
23-
import org.hibernate.boot.jaxb.mapping.JaxbTenantId;
24-
import org.hibernate.boot.jaxb.mapping.JaxbUuidGenerator;
15+
import org.hibernate.boot.jaxb.mapping.spi.JaxbAttributesContainerImpl;
16+
import org.hibernate.boot.jaxb.mapping.spi.JaxbBasicImpl;
17+
import org.hibernate.boot.jaxb.mapping.spi.JaxbColumnImpl;
18+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityImpl;
19+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
20+
import org.hibernate.boot.jaxb.mapping.spi.JaxbIdImpl;
21+
import org.hibernate.boot.jaxb.mapping.spi.JaxbIndexImpl;
22+
import org.hibernate.boot.jaxb.mapping.spi.JaxbTableImpl;
23+
import org.hibernate.boot.jaxb.mapping.spi.JaxbTenantIdImpl;
24+
import org.hibernate.boot.jaxb.mapping.spi.JaxbUuidGeneratorImpl;
2525

2626
public class AdditionalMappingBuilder {
2727

28-
private final JaxbEntity entity;
28+
private final JaxbEntityImpl entity;
2929

3030
public AdditionalMappingBuilder(Class<?> type, String name) {
31-
entity = new JaxbEntity();
31+
entity = new JaxbEntityImpl();
3232
entity.setAccess( AccessType.FIELD );
3333
entity.setClazz( type.getName() );
3434
entity.setName( name );
35-
JaxbTable table = new JaxbTable();
35+
JaxbTableImpl table = new JaxbTableImpl();
3636
entity.setTable( table );
3737

38-
entity.setAttributes( new JaxbAttributes() );
38+
entity.setAttributes( new JaxbAttributesContainerImpl() );
3939
}
4040

4141
public AdditionalMappingBuilder table(String schema, String catalog, String table) {
@@ -51,7 +51,7 @@ public AdditionalMappingBuilder index(String name) {
5151
}
5252

5353
public AdditionalMappingBuilder index(String name, String columns) {
54-
JaxbIndex index = new JaxbIndex();
54+
JaxbIndexImpl index = new JaxbIndexImpl();
5555
index.setName( name );
5656
index.setColumnList( columns );
5757

@@ -71,47 +71,47 @@ public AdditionalMappingBuilder attribute(String name, Integer length, Boolean n
7171
}
7272

7373
public AdditionalMappingBuilder tenantId(String name) {
74-
entity.setTenantId( new JaxbTenantId() );
74+
entity.setTenantId( new JaxbTenantIdImpl() );
7575
entity.getTenantId().setName( name );
7676
return this;
7777
}
7878

7979
public AdditionalMappingBuilder enumAttribute(String name, Integer length, Boolean nullable) {
80-
JaxbBasic attribute = createAttribute( name, length, nullable );
80+
JaxbBasicImpl attribute = createAttribute( name, length, nullable );
8181
attribute.setEnumerated( EnumType.STRING );
8282
entity.getAttributes().getBasicAttributes().add( attribute );
8383
return this;
8484
}
8585

8686
public AdditionalMappingBuilder id(Integer type, String strategy) {
87-
JaxbId id = new JaxbId();
87+
JaxbIdImpl id = new JaxbIdImpl();
8888
id.setName( "id" );
8989
if ( type != null ) {
9090
id.setJdbcTypeCode( type );
9191
}
92-
id.setUuidGenerator( new JaxbUuidGenerator() );
92+
id.setUuidGenerator( new JaxbUuidGeneratorImpl() );
9393
id.getUuidGenerator().setStyle( UuidGenerator.Style.valueOf( strategy.toUpperCase( Locale.ROOT ) ) );
94-
entity.getAttributes().getId().add( id );
94+
entity.getAttributes().getIdAttributes().add( id );
9595

9696
return this;
9797
}
9898

99-
public JaxbEntityMappings build() {
100-
JaxbEntityMappings mappings = new JaxbEntityMappings();
99+
public JaxbEntityMappingsImpl build() {
100+
JaxbEntityMappingsImpl mappings = new JaxbEntityMappingsImpl();
101101

102102
mappings.getEntities().add( entity );
103103

104104
return mappings;
105105
}
106106

107-
private JaxbBasic createAttribute(String name, Integer size, boolean nullable) {
107+
private JaxbBasicImpl createAttribute(String name, Integer size, boolean nullable) {
108108
return createAttribute( name, size, nullable, null );
109109
}
110110

111-
private JaxbBasic createAttribute(String name, Integer size, boolean nullable, Integer type) {
112-
JaxbBasic attribute = new JaxbBasic();
111+
private JaxbBasicImpl createAttribute(String name, Integer size, boolean nullable, Integer type) {
112+
JaxbBasicImpl attribute = new JaxbBasicImpl();
113113
attribute.setName( name );
114-
JaxbColumn column = new JaxbColumn();
114+
JaxbColumnImpl column = new JaxbColumnImpl();
115115
attribute.setColumn( column );
116116
column.setName( name );
117117
column.setNullable( nullable );

mapper/orm-outbox-polling/src/main/java/org/hibernate/search/mapper/orm/outboxpolling/mapping/impl/JaxbMappingHelper.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import jakarta.xml.bind.Marshaller;
1818
import jakarta.xml.bind.Unmarshaller;
1919

20-
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
20+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
2121
import org.hibernate.search.mapper.orm.outboxpolling.logging.impl.Log;
2222
import org.hibernate.search.util.common.logging.impl.LoggerFactory;
2323

@@ -28,9 +28,9 @@ public class JaxbMappingHelper {
2828
private JaxbMappingHelper() {
2929
}
3030

31-
public static String marshall(JaxbEntityMappings mappings) {
31+
public static String marshall(JaxbEntityMappingsImpl mappings) {
3232
try ( ByteArrayOutputStream out = new ByteArrayOutputStream() ) {
33-
JAXBContext context = JAXBContext.newInstance( JaxbEntityMappings.class );
33+
JAXBContext context = JAXBContext.newInstance( JaxbEntityMappingsImpl.class );
3434
Marshaller marshaller = context.createMarshaller();
3535
marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, true );
3636
marshaller.marshal( mappings, out );
@@ -41,11 +41,11 @@ public static String marshall(JaxbEntityMappings mappings) {
4141
}
4242
}
4343

44-
public static JaxbEntityMappings unmarshall(String mappings) {
44+
public static JaxbEntityMappingsImpl unmarshall(String mappings) {
4545
try ( ByteArrayInputStream in = new ByteArrayInputStream( mappings.getBytes( StandardCharsets.UTF_8 ) ) ) {
46-
JAXBContext context = JAXBContext.newInstance( JaxbEntityMappings.class );
46+
JAXBContext context = JAXBContext.newInstance( JaxbEntityMappingsImpl.class );
4747
Unmarshaller unmarshaller = context.createUnmarshaller();
48-
return (JaxbEntityMappings) unmarshaller.unmarshal( in );
48+
return (JaxbEntityMappingsImpl) unmarshaller.unmarshal( in );
4949
}
5050
catch (IOException | JAXBException e) {
5151
throw log.unableToProcessEntityMappings( e.getMessage(), e );

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/bootstrap/impl/HibernateSearchCompositeMappingProducer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Optional;
1111

1212
import org.hibernate.boot.ResourceStreamLocator;
13-
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
13+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
1414
import org.hibernate.boot.spi.AdditionalMappingContributions;
1515
import org.hibernate.boot.spi.AdditionalMappingContributor;
1616
import org.hibernate.boot.spi.InFlightMetadataCollector;
@@ -43,7 +43,7 @@ public void contribute(AdditionalMappingContributions contributions, InFlightMet
4343

4444
for ( HibernateSearchOrmMappingProducer mappingProducer : preIntegrationService
4545
.coordinationStrategyConfiguration().mappingProducers() ) {
46-
for ( Map.Entry<Class<?>, JaxbEntityMappings> entry : mappingProducer.produceMappings(
46+
for ( Map.Entry<Class<?>, JaxbEntityMappingsImpl> entry : mappingProducer.produceMappings(
4747
propertySource,
4848
buildingContext
4949
).entrySet() ) {

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/bootstrap/spi/HibernateSearchOrmMappingProducer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
import java.util.Map;
1010

11-
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
11+
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
1212
import org.hibernate.boot.spi.MetadataBuildingContext;
1313
import org.hibernate.search.engine.cfg.ConfigurationPropertySource;
1414

1515
public interface HibernateSearchOrmMappingProducer {
1616

17-
Map<Class<?>, JaxbEntityMappings> produceMappings(
17+
Map<Class<?>, JaxbEntityMappingsImpl> produceMappings(
1818
ConfigurationPropertySource propertySource,
1919
MetadataBuildingContext buildingContext
2020
);

0 commit comments

Comments
 (0)