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 Hibernate ORM to 7.0.0.Beta3 #2028

Merged
merged 16 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 6 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ jobs:
.gradle/wrapper
# refresh cache every month to avoid unlimited growth
key: gradle-examples-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 11
java-version: 17
- name: Print the effective ORM version used
run: ./gradlew :${{ matrix.example }}:dependencyInsight --dependency org.hibernate.orm:hibernate-core
- name: Run examples in '${{ matrix.example }}' on ${{ matrix.db }}
Expand Down Expand Up @@ -136,11 +136,11 @@ jobs:
.gradle/wrapper
# refresh cache every month to avoid unlimited growth
key: gradle-db-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 11
java-version: 17
- name: Print the effective ORM version used
run: ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
- name: Build and Test with ${{ matrix.db }}
Expand All @@ -165,7 +165,6 @@ jobs:
# To see the available versions and download links on jdk.java.net:
# https://github.com/oracle-actions/setup-java/blob/main/jdk.java.net-uri.properties
java:
- { name: "11", java_version_numeric: 11 }
- { name: "17", java_version_numeric: 17 }
# We want to enable preview features when testing newer builds of OpenJDK:
# even if we don't use these features, just enabling them can cause side effects
Expand Down Expand Up @@ -246,11 +245,11 @@ jobs:
id: testjdk-exportpath
run: echo "::set-output name=path::${JAVA_HOME}"
# Always use JDK 11 to build the main code: that's what we use for releases.
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 11
java-version: 17
check-latest: true
- name: Export path to JDK 11
id: mainjdk-exportpath
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scheduler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
build-snapshots:
strategy:
matrix:
branch: [ 'wip/2.3', 'wip/2.4' ]
branch: [ 'wip/2.3', 'wip/2.4', 'wip/3.0' ]
uses: ./.github/workflows/build.yml
with:
branch: ${{ matrix.branch }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Hibernate Reactive has been tested with:
- CockroachDB v24
- MS SQL Server 2022
- Oracle 23
- [Hibernate ORM][] 6.6.3.Final
- [Hibernate ORM][] 7.0.0.Beta3
- [Vert.x Reactive PostgreSQL Client](https://vertx.io/docs/vertx-pg-client/java/) 4.5.11
- [Vert.x Reactive MySQL Client](https://vertx.io/docs/vertx-mysql-client/java/) 4.5.11
- [Vert.x Reactive Db2 Client](https://vertx.io/docs/vertx-db2-client/java/) 4.5.11
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ext {
vertxSqlClientVersion = '4.5.11'
}

testcontainersVersion = '1.19.8'
testcontainersVersion = '1.20.4'

logger.lifecycle "Vert.x SQL Client Version: " + project.vertxSqlClientVersion
}
Expand Down
4 changes: 2 additions & 2 deletions ci/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pipeline {
label 'Worker&&Containers'
}
tools {
jdk 'OpenJDK 11 Latest'
jdk 'OpenJDK 17 Latest'
}
options {
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '10')
Expand All @@ -73,7 +73,7 @@ pipeline {
string(
name: 'RELEASE_VERSION',
defaultValue: '',
description: 'The version to be released, e.g. 2.4.0.Final. Mandatory for manual releases, to prevent mistakes.',
description: 'The version to be released, e.g. 3.0.0.Beta1. Mandatory for manual releases, to prevent mistakes.',
trim: true
)
string(
Expand Down
2 changes: 1 addition & 1 deletion ci/snapshot-publish.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pipeline {
label 'Fedora'
}
tools {
jdk 'OpenJDK 11 Latest'
jdk 'OpenJDK 17 Latest'
}
options {
rateLimitBuilds(throttle: [count: 1, durationName: 'hour', userBoost: true])
Expand Down
4 changes: 2 additions & 2 deletions documentation/src/main/asciidoc/reference/introduction.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ custom reactive identifier generator.

=== JSON Mapping

:orm-json-basic-mapping: https://docs.jboss.org/hibernate/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#basic-mapping-json
:orm-json-embeddable-mapping: https://docs.jboss.org/hibernate/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#_jsonxml_aggregate_embeddable_mapping
:orm-json-basic-mapping: https://docs.jboss.org/hibernate/orm/7.0/userguide/html_single/Hibernate_User_Guide.html#basic-mapping-json
:orm-json-embeddable-mapping: https://docs.jboss.org/hibernate/orm/7.0/userguide/html_single/Hibernate_User_Guide.html#_jsonxml_aggregate_embeddable_mapping
:string-to-json-converter: https://github.com/hibernate/hibernate-reactive/blob/main/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/StringToJsonConverter.java

Like in Hibernate ORM, it's possible to map a JSON field using the {orm-json-basic-mapping}[SqlTypes.JSON]
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ org.gradle.java.installations.auto-download=false
#enableMavenLocalRepo = true

# The default Hibernate ORM version (override using `-PhibernateOrmVersion=the.version.you.want`)
hibernateOrmVersion = 6.6.3.Final
hibernateOrmVersion = 7.0.0.Beta3

# Override default Hibernate ORM Gradle plugin version
# Using the stable version because I don't know how to configure the build to download the snapshot version from
# a remote repository
#hibernateOrmGradlePluginVersion = 6.6.3.Final
hibernateOrmGradlePluginVersion = 7.0.0.Beta2

# If set to true, skip Hibernate ORM version parsing (default is true, if set to null)
# this is required when using intervals or weird versions or the build will fail
Expand Down
29 changes: 15 additions & 14 deletions hibernate-reactive-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ dependencies {
api 'io.smallrye.reactive:mutiny:2.7.0'

//Logging
implementation 'org.jboss.logging:jboss-logging:3.5.0.Final'
compileOnly 'org.jboss.logging:jboss-logging-annotations:2.2.1.Final'
implementation 'org.jboss.logging:jboss-logging:3.6.1.Final'
annotationProcessor 'org.jboss.logging:jboss-logging:3.6.1.Final'

compileOnly 'org.jboss.logging:jboss-logging-annotations:3.0.3.Final'
annotationProcessor 'org.jboss.logging:jboss-logging-annotations:3.0.3.Final'
annotationProcessor 'org.jboss.logging:jboss-logging-processor:3.0.3.Final'

annotationProcessor 'org.jboss.logging:jboss-logging:3.5.0.Final'
annotationProcessor 'org.jboss.logging:jboss-logging-annotations:2.2.1.Final'
annotationProcessor 'org.jboss.logging:jboss-logging-processor:2.2.1.Final'

//Specific implementation details of Hibernate Reactive:
implementation "io.vertx:vertx-sql-client:${vertxSqlClientVersion}"

// Testing
testImplementation 'org.assertj:assertj-core:3.24.2'
testImplementation 'org.assertj:assertj-core:3.26.3'
testImplementation "io.vertx:vertx-junit5:${vertxSqlClientVersion}"

// Drivers
Expand All @@ -41,26 +42,26 @@ dependencies {
testImplementation 'com.ongres.scram:client:2.1'

// JUnit Jupiter
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'

// JDBC driver to test with ORM and PostgreSQL
testRuntimeOnly "org.postgresql:postgresql:42.7.3"
testRuntimeOnly "org.postgresql:postgresql:42.7.4"

// JDBC driver for Testcontainers with MS SQL Server
testRuntimeOnly "com.microsoft.sqlserver:mssql-jdbc:12.2.0.jre11"
testRuntimeOnly "com.microsoft.sqlserver:mssql-jdbc:12.8.1.jre11"

// JDBC driver for Testcontainers with MariaDB Server
testRuntimeOnly "org.mariadb.jdbc:mariadb-java-client:3.1.4"
testRuntimeOnly "org.mariadb.jdbc:mariadb-java-client:3.5.1"

// JDBC driver for Testcontainers with MYSQL Server
testRuntimeOnly "com.mysql:mysql-connector-j:8.0.33"
testRuntimeOnly "com.mysql:mysql-connector-j:9.1.0"

// JDBC driver for Db2 server, for testing
testRuntimeOnly "com.ibm.db2:jcc:11.5.9.0"
testRuntimeOnly "com.ibm.db2:jcc:12.1.0.0"

// EHCache
testRuntimeOnly ("org.ehcache:ehcache:3.10.0-alpha0") {
testRuntimeOnly ("org.ehcache:ehcache:3.10.8") {
capabilities {
requireCapability 'org.ehcache.modules:ehcache-xml-jakarta'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
*/
package org.hibernate.reactive.adaptor.impl;

import io.vertx.core.buffer.Buffer;

import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -39,12 +34,23 @@
import java.util.Calendar;
import java.util.function.Function;

import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
import org.hibernate.reactive.logging.impl.Log;

import io.vertx.core.buffer.Buffer;

import static java.lang.invoke.MethodHandles.lookup;
import static org.hibernate.reactive.logging.impl.LoggerFactory.make;

/**
* Collects parameter bindings from Hibernate core code
* that expects a JDBC {@link PreparedStatement}.
*/
public class PreparedStatementAdaptor implements PreparedStatement {

private static final Log LOG = make( Log.class, lookup() );

@FunctionalInterface
public interface Binder {
void bind(PreparedStatement statement) throws SQLException;
Expand Down Expand Up @@ -315,7 +321,7 @@ public void setNClob(int parameterIndex, Reader reader, long length) {

@Override
public void setSQLXML(int parameterIndex, SQLXML xmlObject) {
throw new UnsupportedOperationException();
throw LOG.unsupportedXmlType();
}

@Override
Expand Down Expand Up @@ -540,7 +546,7 @@ public int[] executeBatch() {

@Override
public Connection getConnection() {
throw new UnsupportedOperationException();
throw LOG.unexpectedConnectionRequest();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
import java.util.NoSuchElementException;
import java.util.function.Function;

import org.hibernate.engine.jdbc.BlobProxy;
import org.hibernate.engine.jdbc.ClobProxy;
import org.hibernate.engine.jdbc.proxy.BlobProxy;
import org.hibernate.engine.jdbc.proxy.ClobProxy;
import org.hibernate.reactive.logging.impl.Log;
import org.hibernate.type.descriptor.jdbc.JdbcType;

import io.vertx.core.buffer.Buffer;
Expand All @@ -48,15 +49,19 @@
import io.vertx.sqlclient.desc.ColumnDescriptor;
import io.vertx.sqlclient.impl.RowBase;

import static java.lang.invoke.MethodHandles.lookup;
import static java.util.Collections.emptyList;
import static java.util.Objects.requireNonNull;
import static org.hibernate.reactive.logging.impl.LoggerFactory.make;

/**
* An adaptor that allows Hibernate core code which expects a JDBC
* {@code ResultSet} to read values from Vert.x's {@code RowSet}.
*/
public class ResultSetAdaptor implements ResultSet {

private static final Log LOG = make( Log.class, lookup() );

private final Iterator<? extends Row> iterator;

private final List<ColumnDescriptor> columnDescriptors;
Expand Down Expand Up @@ -866,12 +871,12 @@ public NClob getNClob(String columnLabel) {

@Override
public SQLXML getSQLXML(int columnIndex) {
throw new UnsupportedOperationException();
throw LOG.unsupportedXmlType();
}

@Override
public SQLXML getSQLXML(String columnLabel) {
throw new UnsupportedOperationException();
throw LOG.unsupportedXmlType();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import org.hibernate.boot.spi.AbstractDelegatingMetadata;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.query.named.NamedObjectRepository;
import org.hibernate.reactive.query.internal.ReactiveNamedObjectRepositoryImpl;

Expand All @@ -18,7 +17,7 @@ public ReactiveMetadataImplementor(MetadataImplementor delegate) {
}

@Override
public NamedObjectRepository buildNamedQueryRepository(SessionFactoryImplementor sessionFactory) {
return new ReactiveNamedObjectRepositoryImpl( delegate().buildNamedQueryRepository( sessionFactory ) );
public NamedObjectRepository buildNamedQueryRepository() {
return new ReactiveNamedObjectRepositoryImpl( super.buildNamedQueryRepository() );
}
}

This file was deleted.

Loading
Loading