Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
db: [ 'MariaDB', 'MySQL', 'PostgreSQL', 'DB2', 'CockroachDB' ]
db: [ 'MariaDB', 'MySQL', 'PostgreSQL', 'DB2', 'CockroachDB', 'MSSQLServer' ]
steps:
- uses: actions/checkout@v2
- name: Get year/month for cache key
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tracking-orm-5.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
strategy:
matrix:
orm-version: [ '[5.4,5.5)','[5.5,5.6)' ]
db: ['MariaDB', 'MySQL', 'PostgreSQL', 'DB2', 'CockroachDB']
db: ['MariaDB', 'MySQL', 'PostgreSQL', 'DB2', 'CockroachDB', 'MSSQLServer']
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tracking-vertx-4.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
strategy:
matrix:
vertx-version: [ '[4.1,4.2)' ]
db: [ 'MariaDB', 'MySQL', 'PostgreSQL', 'DB2', 'CockroachDB' ]
db: [ 'MariaDB', 'MySQL', 'PostgreSQL', 'DB2', 'CockroachDB', 'MSSQLServer' ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Hibernate Reactive may be used in any plain Java program, but is
especially targeted toward usage in reactive environments like
[Quarkus][] and [Vert.x][].

Currently [PostgreSQL][], [MySQL][], [MariaDB][], [Db2][], and
[CockroachDB][] are supported.
Currently [PostgreSQL][], [MySQL][], [MariaDB][], [Db2][],
[CockroachDB][] and [MS SQL Server][MSSQL] are supported.

Learn more at <http://hibernate.org/reactive>.

Expand All @@ -34,19 +34,20 @@ Hibernate Reactive has been tested with:
- MariaDB 10
- Db2 11.5
- CockroachDB 21.1
- [Hibernate ORM][] 5.5.3.Final
- [Vert.x Reactive PostgreSQL Client](https://vertx.io/docs/vertx-pg-client/java/) 4.1.1
- [Vert.x Reactive MySQL Client](https://vertx.io/docs/vertx-mysql-client/java/) 4.1.1
- [Vert.x Reactive Db2 Client](https://vertx.io/docs/vertx-db2-client/java/) 4.1.1
- MS SQL Server 2019
- [Hibernate ORM][] 5.5.4.Final
- [Vert.x Reactive PostgreSQL Client](https://vertx.io/docs/vertx-pg-client/java/) 4.1.2
- [Vert.x Reactive MySQL Client](https://vertx.io/docs/vertx-mysql-client/java/) 4.1.2
- [Vert.x Reactive Db2 Client](https://vertx.io/docs/vertx-db2-client/java/) 4.1.2
- [Vert.x Reactive MS SQL Server Client](https://vertx.io/docs/vertx-mssql-client/java/) 4.1.2
- [Quarkus][Quarkus] via the Hibernate Reactive extension

Support for SQL Server is coming soon.

[PostgreSQL]: https://www.postgresql.org
[MySQL]: https://www.mysql.com
[MariaDB]: https://mariadb.com
[DB2]: https://www.ibm.com/analytics/db2
[CockroachDB]: https://www.cockroachlabs.com/
[MSSQL]: https://www.microsoft.com/en-gb/sql-server

## Documentation

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ version = projectVersion
// ./gradlew clean build -PhibernateOrmVersion=5.5.1-SNAPSHOT
ext {
if ( !project.hasProperty('hibernateOrmVersion') ) {
hibernateOrmVersion = '5.5.3.Final'
hibernateOrmVersion = '5.5.4.Final'
}
// For ORM, we need a parsed version (to get the family, ...)

Expand All @@ -79,7 +79,7 @@ ext {
// Example:
// ./gradlew build -PvertxVersion=4.0.0-SNAPSHOT
if ( !project.hasProperty('vertxVersion') ) {
vertxVersion = '4.1.1'
vertxVersion = '4.1.2'
}

testcontainersVersion = '1.15.3'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ org.gradle.java.installations.auto-download=false
#skipOrmVersionParsing = true

# Override default Vert.x version
#vertxVersion = 4.1.1-SNAPSHOT
#vertxVersion = 4.1.2-SNAPSHOT

4 changes: 4 additions & 0 deletions hibernate-reactive-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ dependencies {
testImplementation "io.vertx:vertx-pg-client:${vertxVersion}"
testImplementation "io.vertx:vertx-mysql-client:${vertxVersion}"
testImplementation "io.vertx:vertx-db2-client:${vertxVersion}"
testImplementation "io.vertx:vertx-mssql-client:${vertxVersion}"

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

// JDBC driver for Testcontainers with MS SQL Server
testRuntimeOnly "com.microsoft.sqlserver:mssql-jdbc:9.2.1.jre8"
// EHCache
testRuntimeOnly "org.ehcache:ehcache:3.8.1"
testRuntimeOnly ("org.hibernate:hibernate-jcache:${hibernateOrmVersion}") {
Expand All @@ -59,6 +62,7 @@ dependencies {
testImplementation "org.testcontainers:mariadb:${testcontainersVersion}"
testImplementation "org.testcontainers:db2:${testcontainersVersion}"
testImplementation "org.testcontainers:cockroachdb:${testcontainersVersion}"
testImplementation "org.testcontainers:mssqlserver:${testcontainersVersion}"
}

// Print a summary of the results of the tests (number of failures, successes and skipped)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
package org.hibernate.reactive.adaptor.impl;

import org.hibernate.dialect.pagination.LimitHandler;
import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.param.ParameterSpecification;
Expand All @@ -18,7 +19,8 @@ private QueryParametersAdaptor() {
}

public static Object[] arguments(QueryParameters queryParameters,
SharedSessionContractImplementor session) {
SharedSessionContractImplementor session,
LimitHandler limitHandler) {
return PreparedStatementAdaptor.bind( adaptor -> {
Type[] types = queryParameters.getFilteredPositionalParameterTypes();
Object[] values = queryParameters.getFilteredPositionalParameterValues();
Expand All @@ -29,6 +31,8 @@ public static Object[] arguments(QueryParameters queryParameters,
type.nullSafeSet( adaptor, value, pos, session );
pos += type.getColumnSpan( session.getFactory() );
}

pos += limitHandler.bindLimitParametersAtEndOfQuery( queryParameters.getRowSelection(), adaptor, pos );
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
*/
package org.hibernate.reactive.bulk;

import java.util.concurrent.CompletionStage;

import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.param.ParameterSpecification;
import org.hibernate.reactive.adaptor.impl.QueryParametersAdaptor;
import org.hibernate.reactive.session.ReactiveQueryExecutor;

import static org.hibernate.reactive.util.impl.CompletionStages.total;

/**
* A list of SQL statements to be executed as a single logical unit.
Expand All @@ -26,22 +33,16 @@ public interface StatementsWithParameters {
ParameterSpecification[][] getParameterSpecifications();

/**
* Is the given statement executed inside the current transaction?
*
* @return true by default
*/
default boolean isTransactionalStatement(String statement) {
return true;
}

/**
* Should the result of this statement contribute to the running
* updated row count?
*
* @return false for DDL statements by default
* Execute the statements using the query parameters
*/
default boolean isSchemaDefinitionStatement(String statement) {
return statement.startsWith("create ")
|| statement.startsWith("drop ");
default CompletionStage<Integer> execute(ReactiveQueryExecutor session, QueryParameters queryParameters) {
return total( 0, getSqlStatements().length, i -> {
final Object[] arguments = QueryParametersAdaptor.arguments(
queryParameters,
getParameterSpecifications()[i],
session.getSharedContract()
);
return session.getReactiveConnection().update( getSqlStatements()[i], arguments );
} );
}
}
Loading