Skip to content

Commit

Permalink
[#1949] Upgrade Hibernate ORM to 6.6.0.CR2
Browse files Browse the repository at this point in the history
To make this work I had to refactor the Cascade class.
I don't know what wasn't working, but a test was failing and
couldn't figure out what was wrong. I think the class now
is more similar to the one in Hibernate ORM, it's easier to debug,
logs the messages in the correct order, and it fixes the issues
I had.
  • Loading branch information
DavideD committed Aug 2, 2024
1 parent b73f9e0 commit 23677c4
Show file tree
Hide file tree
Showing 76 changed files with 4,202 additions and 1,957 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ Learn more at <http://hibernate.org/reactive>.

Hibernate Reactive has been tested with:

- Java 11, 17, 20, 21
- Java 11, 17, 20, 21, 22
- PostgreSQL 16
- MySQL 8
- MariaDB 11
- Db2 11
- CockroachDB v24
- MS SQL Server 2022
- Oracle 23
- [Hibernate ORM][] 6.5.2.Final
- [Hibernate ORM][] 6.6.0.CR2
- [Vert.x Reactive PostgreSQL Client](https://vertx.io/docs/vertx-pg-client/java/) 4.5.8
- [Vert.x Reactive MySQL Client](https://vertx.io/docs/vertx-mysql-client/java/) 4.5.8
- [Vert.x Reactive Db2 Client](https://vertx.io/docs/vertx-db2-client/java/) 4.5.8
Expand Down
2 changes: 1 addition & 1 deletion 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.6.15-SNAPSHOT
ext {
if ( !project.hasProperty('hibernateOrmVersion') ) {
hibernateOrmVersion = '6.5.2.Final'
hibernateOrmVersion = '6.6.0.CR2'
}
if ( !project.hasProperty( 'hibernateOrmGradlePluginVersion' ) ) {
// Same as ORM as default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,8 @@ public CompletionStage<Void> addAction(ReactiveEntityInsertAction action) {
return addInsertAction( action );
}

private CompletionStage<Void> addInsertAction( ReactiveEntityInsertAction insert) {
CompletionStage<Void> ret = voidFuture();
if ( insert.isEarlyInsert() ) {
// For early inserts, must execute inserts before finding non-nullable transient entities.
// TODO: find out why this is necessary
LOG.tracev( "Executing inserts before finding non-nullable transient entities for early insert: [{0}]", insert );
ret = ret.thenCompose( v -> executeInserts() );
}

return ret
private CompletionStage<Void> addInsertAction(ReactiveEntityInsertAction insert) {
return executeEarlyInsertsIfRequired( insert )
.thenCompose( v -> insert.reactiveFindNonNullableTransientEntities() )
.thenCompose( nonNullables -> {
if ( nonNullables == null ) {
Expand All @@ -270,40 +262,51 @@ private CompletionStage<Void> addInsertAction( ReactiveEntityInsertAction insert
} );
}

private CompletionStage<Void> executeEarlyInsertsIfRequired(ReactiveEntityInsertAction insert) {
if ( insert.isEarlyInsert() ) {
// For early inserts, must execute inserts before finding non-nullable transient entities.
// TODO: find out why this is necessary
LOG.tracev(
"Executing inserts before finding non-nullable transient entities for early insert: [{0}]",
insert
);
return executeInserts();
}
return voidFuture();
}

private CompletionStage<Void> addResolvedEntityInsertAction(ReactiveEntityInsertAction insert) {
CompletionStage<Void> ret;
if ( insert.isEarlyInsert() ) {
LOG.trace( "Executing insertions before resolved early-insert" );
ret = executeInserts()
.thenCompose( v -> {
// For early inserts, must execute inserts before finding non-nullable transient entities.
LOG.tracev( "Executing inserts before finding non-nullable transient entities for early insert: [{0}]", insert );
return executeInserts().thenCompose( v -> {
LOG.debug( "Executing identity-insert immediately" );
return execute( insert );
} );
} )
.thenCompose( v -> postResolvedEntityInsertAction( insert ) );
}
else {
LOG.trace( "Adding resolved non-early insert action." );
OrderedActions.EntityInsertAction.ensureInitialized( this );
this.insertions.add( new ReactiveEntityInsertActionHolder( insert ) );
ret = voidFuture();
return postResolvedEntityInsertAction( insert );
}
}

return ret.thenCompose( v -> {
if ( !insert.isVeto() ) {
CompletionStage<Void> comp = insert.reactiveMakeEntityManaged();
if ( unresolvedInsertions == null ) {
return comp;
}
else {
return comp.thenCompose( vv -> loop(
private CompletionStage<Void> postResolvedEntityInsertAction(ReactiveEntityInsertAction insert) {
if ( !insert.isVeto() ) {
return insert.reactiveMakeEntityManaged().thenCompose( v -> {
if ( unresolvedInsertions != null ) {
return loop(
unresolvedInsertions.resolveDependentActions( insert.getInstance(), session.getSharedContract() ),
resolvedAction -> addResolvedEntityInsertAction( (ReactiveEntityRegularInsertAction) resolvedAction )
) );
);
}
}
else {
throw new ReactiveEntityActionVetoException( "The ReactiveEntityInsertAction was vetoed.", insert );
}
} );
return voidFuture();
} );
}

throw new ReactiveEntityActionVetoException( "The ReactiveEntityInsertAction was vetoed.", insert );
}

private static String[] convertTimestampSpaces(Serializable[] spaces) {
Expand Down
Loading

0 comments on commit 23677c4

Please sign in to comment.