Skip to content

Commit

Permalink
HSEARCH-4791 Upgrade to Hibernate ORM 6.2.0.CR2
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Jul 3, 2023
1 parent 10b4fa5 commit f944336
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@
<artifactId>${jdbc.driver.artifactId}</artifactId>
<scope>test</scope>
</dependency>
<!-- For some reason jakarta.transaction-api requires CDI at runtime:
https://github.com/jakartaee/transactions/pull/212 -->
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.jakarta.enterprise}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
9 changes: 9 additions & 0 deletions integrationtest/java/modules/orm-elasticsearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
<artifactId>${jdbc.driver.artifactId}</artifactId>
<scope>test</scope>
</dependency>
<!-- For some reason jakarta.transaction-api requires CDI at runtime:
https://github.com/jakartaee/transactions/pull/212 -->
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.jakarta.enterprise}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
9 changes: 9 additions & 0 deletions integrationtest/java/modules/orm-lucene/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
<artifactId>${jdbc.driver.artifactId}</artifactId>
<scope>test</scope>
</dependency>
<!-- For some reason jakarta.transaction-api requires CDI at runtime:
https://github.com/jakartaee/transactions/pull/212 -->
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.jakarta.enterprise}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

import org.hibernate.Hibernate;
import org.hibernate.SessionFactory;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;
Expand Down Expand Up @@ -139,7 +137,8 @@ public static class Group {
private int someInteger;

@OneToMany(mappedBy = "group")
@LazyCollection(LazyCollectionOption.EXTRA)
@SuppressWarnings("deprecation")
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
private Set<Post> posts = new HashSet<>();

public Integer getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import jakarta.persistence.OrderColumn;
import jakarta.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;
import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock;
Expand Down Expand Up @@ -131,7 +129,8 @@ public static class Post {
private String name;

@OneToMany(mappedBy = "post", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@LazyCollection(LazyCollectionOption.EXTRA)
@SuppressWarnings("deprecation")
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
@OrderColumn(name = "idx")
private List<Comment> comments = new ArrayList<>();

Expand Down
14 changes: 14 additions & 0 deletions mapper/orm-batch-jsr352/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@
<artifactId>jakarta.batch-api</artifactId>
</dependency>

<!-- This dependency is only here to solve Moditect errors.
For some reason, the jakarta.transaction module requires jakarta.cdi,
but the jakarta.transaction-api Maven module doesn't depend on jakarta.enterprise.cdi-api,
and that doesn't play well with Moditect, which ends up throwing an exception:
Execution add-module-infos of goal org.moditect:moditect-maven-plugin:1.0.0.RC2:add-module-info failed: Module jakarta.interceptor not found, required by jakarta.transaction
-->
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.jakarta.enterprise}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-util-internal-test-orm</artifactId>
Expand Down
15 changes: 0 additions & 15 deletions mapper/orm-batch-jsr352/jberet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,6 @@
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
</dependency>

<!-- This dependency is only here to solve javadoc warnings.
For some reason, if we rely on the transitive dependency from mapper-orm,
we end up with javadoc warnings like this:
unknown enum constant XmlAccessType.FIELD
This seems related to the annotation processor,
but who knows what the exact reason is.
-->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.jakarta.xml.bind}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
42 changes: 28 additions & 14 deletions mapper/orm-coordination-outbox-polling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm</artifactId>
</dependency>
<!-- This dependency is only here to solve compilation warnings.
For some reason, if we rely on the transitive dependency from mapper-orm,
we end up with compilation warnings like this:
unknown enum constant XmlAccessType.FIELD
This seems related to the annotation processor,
but who knows what the exact reason is.
-->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.jakarta.xml.bind}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
Expand All @@ -49,6 +35,34 @@
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
</dependency>

<!-- This dependency is only here to solve Moditect errors.
For some reason, the jakarta.transaction module requires jakarta.interceptor,
but the jakarta.transaction-api Maven module doesn't depend on jakarta.interceptor-api,
and that doesn't play well with Moditect, which ends up throwing an exception:
Execution add-module-infos of goal org.moditect:moditect-maven-plugin:1.0.0.RC2:add-module-info failed: Module jakarta.interceptor not found, required by jakarta.transaction
-->
<dependency>
<groupId>jakarta.interceptor</groupId>
<artifactId>jakarta.interceptor-api</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.jakarta.interceptor-api}</version>
<scope>provided</scope>
</dependency>
<!-- This dependency is only here to solve Moditect errors.
For some reason, the jakarta.transaction module requires jakarta.cdi,
but the jakarta.transaction-api Maven module doesn't depend on jakarta.enterprise.cdi-api,
and that doesn't play well with Moditect, which ends up throwing an exception:
Execution add-module-infos of goal org.moditect:moditect-maven-plugin:1.0.0.RC2:add-module-info failed: Module jakarta.interceptor not found, required by jakarta.transaction
-->
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.jakarta.enterprise}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-util-internal-test-orm</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ final class OutboxEventLoader implements ToStringTreeAppendable {
// they will actually end up locking more than their subset,
// and then conflicts *can* occur.
// Disabling locks is not an option: we cannot disable locking during deletes.
// Thus, our last option is to actually enforce locks ahead of time (LockModeType.PESSIMISTIC_WRITE),
// and to avoid conflicts by simply never working on events that are already locked (LockOptions.SKIP_LOCKED).
// Thus, our last option is to actually enforce locks ahead of time (UPGRADE),
// and to avoid conflicts by simply never working on events that are already locked (SKIP_LOCKED):
// that's what LockMode.UPGRADE_SKIPLOCKED is for.
// That's possible because event processing is not sensitive to processing order,
// so we can afford to just skip events that are already locked,
// and process them later when they are no longer locked.
if ( dialect.supportsSkipLocked() ) {
lockOptions = new LockOptions( LockMode.PESSIMISTIC_WRITE ).setTimeOut( LockOptions.SKIP_LOCKED );
lockOptions = new LockOptions( LockMode.UPGRADE_SKIPLOCKED );
}
// If SKIP_LOCKED is not supported, we just do basic locking and hope for the best
// (in particular we hope for transaction deadlocks to be detected by the database and result in a failure,
Expand Down
6 changes: 6 additions & 0 deletions mapper/orm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.org.hibernate.commons.annotations}</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<version>${version.io.smallrye.jandex}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ private UnsupportedOperationException parametersNoSupported() {
}

@Override
public QueryImplementor<R> setTupleTransformer(TupleTransformer transformer) {
public <T> QueryImplementor<T> setTupleTransformer(TupleTransformer<T> transformer) {
throw resultOrTupleTransformerNotImplemented();
}

@Override
public QueryImplementor<R> setResultListTransformer(ResultListTransformer resultListTransformer) {
public QueryImplementor<R> setResultListTransformer(ResultListTransformer<R> resultListTransformer) {
throw resultOrTupleTransformerNotImplemented();
}

Expand Down
42 changes: 9 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,10 @@
<version.org.jboss.jandex>2.4.2.Final</version.org.jboss.jandex>
<version.org.hibernate.commons.annotations>${version.org.hibernate.commons.annotations.orm6}</version.org.hibernate.commons.annotations>
<version.net.bytebuddy>${version.net.bytebuddy.orm6}</version.net.bytebuddy>
<version.io.smallrye.jandex>3.0.0</version.io.smallrye.jandex>

<!-- >>> ORM 6 with Jakarta Persistence -->
<version.org.hibernate.orm>6.1.6.Final</version.org.hibernate.orm>
<version.org.hibernate.orm>6.2.0.CR2</version.org.hibernate.orm>
<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>
<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>
<!-- These version must be kept in sync with the version of the dependency in Hibernate ORM 6.
Expand All @@ -280,12 +281,12 @@
-->
<version.io.smallrye.jandex>3.0.5</version.io.smallrye.jandex>
<version.org.hibernate.commons.annotations.orm6>6.0.5.Final</version.org.hibernate.commons.annotations.orm6>
<version.jakarta.persistence>3.0.0</version.jakarta.persistence>
<version.jakarta.transaction-api>2.0.0</version.jakarta.transaction-api>
<version.jakarta.persistence>3.1.0</version.jakarta.persistence>
<version.jakarta.transaction-api>2.0.1</version.jakarta.transaction-api>
<version.jakarta.interceptor-api>2.0.1</version.jakarta.interceptor-api>
<version.jakarta.enterprise>3.0.1</version.jakarta.enterprise>
<version.jakarta.xml.bind>3.0.1</version.jakarta.xml.bind>
<version.net.bytebuddy.orm6>1.12.9</version.net.bytebuddy.orm6>
<version.jakarta.xml.bind>4.0.0</version.jakarta.xml.bind>
<version.net.bytebuddy.orm6>1.12.18</version.net.bytebuddy.orm6>

<!-- >>> JSR 352 -->
<version.jakarta.batch>2.1.1</version.jakarta.batch>
Expand Down Expand Up @@ -892,14 +893,6 @@
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>${version.org.hibernate.orm}</version>
<exclusions>
<!-- hibernate-core already depends on jakarta.xml.bind-api,
which depends on com.sun.activation, which bundles the activation API already -->
<exclusion>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
Expand Down Expand Up @@ -1255,29 +1248,12 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<!-- DO NOT MANAGE the version of this dependency. -->
<exclusions>
<!-- Also imported by Hibernate ORM -->
<exclusion>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</exclusion>
<!-- Also imported by jakarta.xml.bind-api -->
<exclusion>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<!-- DO NOT MANAGE the version of this dependency. -->
<!-- DO NOT REMOVE and DO NOT MANAGE the version of this dependency. See the version property declaration. -->
<exclusions>
<!-- Also imported by jakarta.xml.bind-api -->
<exclusion>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down

0 comments on commit f944336

Please sign in to comment.