Skip to content

Commit fbcde99

Browse files
committed
[#1949] Upgrade Hibernate ORM to 6.6.0.CR2
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.
1 parent a6de533 commit fbcde99

File tree

81 files changed

+4359
-2053
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4359
-2053
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ Learn more at <http://hibernate.org/reactive>.
2929

3030
Hibernate Reactive has been tested with:
3131

32-
- Java 11, 17, 20, 21
32+
- Java 11, 17, 20, 21, 22
3333
- PostgreSQL 16
3434
- MySQL 8
3535
- MariaDB 11
3636
- Db2 11
3737
- CockroachDB v24
3838
- MS SQL Server 2022
3939
- Oracle 23
40-
- [Hibernate ORM][] 6.5.2.Final
40+
- [Hibernate ORM][] 6.6.0.CR2
4141
- [Vert.x Reactive PostgreSQL Client](https://vertx.io/docs/vertx-pg-client/java/) 4.5.9
4242
- [Vert.x Reactive MySQL Client](https://vertx.io/docs/vertx-mysql-client/java/) 4.5.9
4343
- [Vert.x Reactive Db2 Client](https://vertx.io/docs/vertx-db2-client/java/) 4.5.9

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ version = projectVersion
5353
// ./gradlew clean build -PhibernateOrmVersion=5.6.15-SNAPSHOT
5454
ext {
5555
if ( !project.hasProperty('hibernateOrmVersion') ) {
56-
hibernateOrmVersion = '6.5.2.Final'
56+
hibernateOrmVersion = '6.6.0.CR2'
5757
}
5858
if ( !project.hasProperty( 'hibernateOrmGradlePluginVersion' ) ) {
5959
// Same as ORM as default

hibernate-reactive-core/src/main/java/org/hibernate/reactive/engine/ReactiveActionQueue.java

+33-30
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,8 @@ public CompletionStage<Void> addAction(ReactiveEntityInsertAction action) {
241241
return addInsertAction( action );
242242
}
243243

244-
private CompletionStage<Void> addInsertAction( ReactiveEntityInsertAction insert) {
245-
CompletionStage<Void> ret = voidFuture();
246-
if ( insert.isEarlyInsert() ) {
247-
// For early inserts, must execute inserts before finding non-nullable transient entities.
248-
// TODO: find out why this is necessary
249-
LOG.tracev( "Executing inserts before finding non-nullable transient entities for early insert: [{0}]", insert );
250-
ret = ret.thenCompose( v -> executeInserts() );
251-
}
252-
253-
return ret
244+
private CompletionStage<Void> addInsertAction(ReactiveEntityInsertAction insert) {
245+
return executeEarlyInsertsIfRequired( insert )
254246
.thenCompose( v -> insert.reactiveFindNonNullableTransientEntities() )
255247
.thenCompose( nonNullables -> {
256248
if ( nonNullables == null ) {
@@ -270,40 +262,51 @@ private CompletionStage<Void> addInsertAction( ReactiveEntityInsertAction insert
270262
} );
271263
}
272264

265+
private CompletionStage<Void> executeEarlyInsertsIfRequired(ReactiveEntityInsertAction insert) {
266+
if ( insert.isEarlyInsert() ) {
267+
// For early inserts, must execute inserts before finding non-nullable transient entities.
268+
// TODO: find out why this is necessary
269+
LOG.tracev(
270+
"Executing inserts before finding non-nullable transient entities for early insert: [{0}]",
271+
insert
272+
);
273+
return executeInserts();
274+
}
275+
return voidFuture();
276+
}
277+
273278
private CompletionStage<Void> addResolvedEntityInsertAction(ReactiveEntityInsertAction insert) {
274-
CompletionStage<Void> ret;
275279
if ( insert.isEarlyInsert() ) {
276-
LOG.trace( "Executing insertions before resolved early-insert" );
277-
ret = executeInserts()
278-
.thenCompose( v -> {
280+
// For early inserts, must execute inserts before finding non-nullable transient entities.
281+
LOG.tracev( "Executing inserts before finding non-nullable transient entities for early insert: [{0}]", insert );
282+
return executeInserts().thenCompose( v -> {
279283
LOG.debug( "Executing identity-insert immediately" );
280284
return execute( insert );
281-
} );
285+
} )
286+
.thenCompose( v -> postResolvedEntityInsertAction( insert ) );
282287
}
283288
else {
284289
LOG.trace( "Adding resolved non-early insert action." );
285290
OrderedActions.EntityInsertAction.ensureInitialized( this );
286291
this.insertions.add( new ReactiveEntityInsertActionHolder( insert ) );
287-
ret = voidFuture();
292+
return postResolvedEntityInsertAction( insert );
288293
}
294+
}
289295

290-
return ret.thenCompose( v -> {
291-
if ( !insert.isVeto() ) {
292-
CompletionStage<Void> comp = insert.reactiveMakeEntityManaged();
293-
if ( unresolvedInsertions == null ) {
294-
return comp;
295-
}
296-
else {
297-
return comp.thenCompose( vv -> loop(
296+
private CompletionStage<Void> postResolvedEntityInsertAction(ReactiveEntityInsertAction insert) {
297+
if ( !insert.isVeto() ) {
298+
return insert.reactiveMakeEntityManaged().thenCompose( v -> {
299+
if ( unresolvedInsertions != null ) {
300+
return loop(
298301
unresolvedInsertions.resolveDependentActions( insert.getInstance(), session.getSharedContract() ),
299302
resolvedAction -> addResolvedEntityInsertAction( (ReactiveEntityRegularInsertAction) resolvedAction )
300-
) );
303+
);
301304
}
302-
}
303-
else {
304-
throw new ReactiveEntityActionVetoException( "The ReactiveEntityInsertAction was vetoed.", insert );
305-
}
306-
} );
305+
return voidFuture();
306+
} );
307+
}
308+
309+
throw new ReactiveEntityActionVetoException( "The ReactiveEntityInsertAction was vetoed.", insert );
307310
}
308311

309312
private static String[] convertTimestampSpaces(Serializable[] spaces) {

0 commit comments

Comments
 (0)