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

New main with Hibernate Reactive 2 #1487

Merged
merged 176 commits into from
Mar 2, 2023
Merged
Changes from 1 commit
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
0f8730d
Remove examples and integration test with verticles
DavideD Sep 29, 2022
4a1bdce
Import AsciiDoctorTask in the build
DavideD Sep 29, 2022
5c589fe
Enable local repositor and docker as default
DavideD Sep 29, 2022
95f3ba5
Set Hibernate ORM version to 6.2.0-SNAPSHOT
DavideD Sep 29, 2022
4165d29
Update JBang templates
DavideD Sep 29, 2022
1cf97be
Update log4j.properties
DavideD Sep 29, 2022
b038163
Clean up the db without using criteria
DavideD Sep 29, 2022
189bccb
Fix tests imports: remove reference to javax.persistence
DavideD Sep 29, 2022
691e93d
Generic test fixes and clean up
DavideD Sep 29, 2022
483e78e
Remove some classes to avoid compilation errors:
DavideD Sep 30, 2022
6b07d98
Remove javax.persitence in docs
DavideD Sep 30, 2022
448ccad
Remove javax.persistence in src/main
DavideD Sep 30, 2022
ff8ab6c
Delete existing loaders
DavideD Sep 30, 2022
3df2363
Update PersistenceProvider service definition
DavideD Sep 30, 2022
2977cca
Disable queries and criterias
DavideD Sep 30, 2022
cd40b62
Update event listeners
DavideD Sep 30, 2022
9983230
Fix entity type format
DavideD Sep 30, 2022
e551839
Add new classes for loading entities
DavideD Sep 30, 2022
6804023
Add IdentifierGenerationException to the Log
DavideD Sep 30, 2022
c40d959
Format EntityTypes class
DavideD Sep 30, 2022
92b4326
Format ReactiveServiceInitiators
DavideD Sep 30, 2022
1b67602
Format EmulatedSequenceReactiveIdentifierGenerator
DavideD Sep 30, 2022
522def3
Delete ReactiveIdentifierGeneratorFactory
DavideD Sep 30, 2022
e7e9117
Update db dialect classes
DavideD Sep 30, 2022
e23aa3c
Disable a couple of method calls not yet supported
DavideD Sep 30, 2022
b3ff149
Fix compilation errors and adapt the new patterns for loading entities
DavideD Sep 30, 2022
f2f328a
fix
DavideD Nov 11, 2022
5f9d691
fix
DavideD Nov 16, 2022
7dfac1e
fix
DavideD Nov 16, 2022
37fb038
fix
DavideD Nov 16, 2022
388d574
[#1376] Log the method that caused the exception
DavideD Nov 17, 2022
4a4c36b
fix
DavideD Nov 17, 2022
0628ae6
fix
DavideD Nov 18, 2022
4efac80
Ignore tests with Sequences
DavideD Nov 19, 2022
b5f8577
Fix
DavideD Nov 19, 2022
16dfa53
fix
DavideD Nov 20, 2022
f27eb61
Add query interfaces to Mutiny and Stage interfaces
DavideD Nov 23, 2022
4f59093
fix
DavideD Nov 23, 2022
fc3daed
fix
DavideD Nov 23, 2022
8ca1c9f
fix
DavideD Nov 23, 2022
bc9add5
Checkpoint: Query interfaces
DavideD Nov 24, 2022
bc469af
fix
DavideD Nov 24, 2022
a1b273c
fix
DavideD Nov 24, 2022
e435d24
fix
DavideD Nov 24, 2022
0795b2b
Checkpoint compiles
DavideD Nov 24, 2022
ec61192
Skip prepareForQueryExecution
DavideD Nov 24, 2022
07e2fbd
fix
DavideD Nov 24, 2022
eb7e943
fix
DavideD Nov 25, 2022
b1bbbcf
fix
DavideD Nov 25, 2022
84d9b4b
fix
DavideD Nov 25, 2022
298c020
fix
DavideD Nov 25, 2022
abdd129
fix
DavideD Nov 26, 2022
da54438
fix
DavideD Nov 26, 2022
5d3e5e9
fix
DavideD Nov 26, 2022
6125a30
fix
DavideD Nov 26, 2022
1111176
fix
DavideD Nov 26, 2022
36bb428
fix
DavideD Nov 26, 2022
f54a46c
Disable tests that are getting stuck
DavideD Nov 26, 2022
1ba5e87
fix
DavideD Nov 26, 2022
3c180ac
Fix
DavideD Nov 27, 2022
775a7be
Schema validation fixed
DavideD Nov 27, 2022
4af2824
fix
DavideD Nov 28, 2022
aa5b76e
345 passed, 413 failed
DavideD Nov 28, 2022
6d85c26
350 passed, 408 failed
DavideD Nov 28, 2022
16ff189
354 passed, 404 failed
DavideD Nov 28, 2022
cedaf14
358 passed, 400 failed
DavideD Nov 28, 2022
3770f1b
363 passed, 395 failed
DavideD Nov 28, 2022
195c21f
VertxEventLoopThread
DavideD Nov 28, 2022
fdd8ba3
Remove import
DavideD Nov 28, 2022
9a47461
fix
DavideD Nov 28, 2022
42623ab
370 passed, 388 failed
DavideD Nov 28, 2022
eb53c80
fix
DavideD Nov 28, 2022
afdf012
372 passed
DavideD Nov 28, 2022
054038b
375 passed, 383 failed
DavideD Nov 28, 2022
6aa5977
fix
DavideD Nov 29, 2022
397598c
Fix
DavideD Nov 30, 2022
da815d4
Fix
DavideD Nov 30, 2022
1cf7d3d
Fix
DavideD Nov 30, 2022
9dd8360
fix
DavideD Nov 30, 2022
9edeb74
fix
DavideD Nov 30, 2022
6cb51f9
fix
DavideD Nov 30, 2022
0d9c1b8
fix
DavideD Dec 1, 2022
542161c
fix
DavideD Dec 5, 2022
6e12ad8
fix
DavideD Dec 5, 2022
01abbed
fix
DavideD Dec 5, 2022
2267d92
fix
DavideD Dec 6, 2022
cae6b14
fix
DavideD Dec 13, 2022
9efeddd
fix
DavideD Dec 16, 2022
776d104
fix
DavideD Dec 18, 2022
04f9724
fix
DavideD Dec 19, 2022
fa904f0
fix
DavideD Dec 19, 2022
55d06fe
fix
DavideD Jan 5, 2023
43ce484
Upgrade to ORM CR1
DavideD Jan 6, 2023
e0ddfe3
Compiles... kinda
DavideD Jan 11, 2023
4b1dc6f
Postgres Identity insertSelect query
DavideD Jan 11, 2023
f0d1c38
PostgreSQL results: FAILURE (800 tests, 247 passed, 515 failed, 38 sk…
DavideD Jan 11, 2023
dd88a02
PostgreSQL results: FAILURE (800 tests, 283 passed, 479 failed, 38 sk…
DavideD Jan 12, 2023
011cc0d
fix
DavideD Jan 12, 2023
f4a60e5
PostgreSQL results: FAILURE (800 tests, 296 passed, 466 failed, 38 sk…
DavideD Jan 12, 2023
4fe6e9a
PostgreSQL results: FAILURE (800 tests, 318 passed, 444 failed, 38 sk…
DavideD Jan 14, 2023
59d6273
PostgreSQL results: FAILURE (800 tests, 322 passed, 440 failed, 38 sk…
DavideD Jan 14, 2023
c70b779
PostgreSQL results: FAILURE (800 tests, 324 passed, 438 failed, 38 sk…
DavideD Jan 15, 2023
2854936
PostgreSQL results: FAILURE (800 tests, 325 passed, 437 failed, 38 sk…
DavideD Jan 15, 2023
cb3f44c
Fix
DavideD Jan 15, 2023
7558381
fix:x
DavideD Jan 16, 2023
f193cb0
PostgreSQL results: FAILURE (800 tests, 465 passed, 268 failed, 67 sk…
DavideD Jan 16, 2023
443ff9f
PostgreSQL results: FAILURE (800 tests, 471 passed, 262 failed, 67 sk…
DavideD Jan 16, 2023
b6e4196
PostgreSQL results: FAILURE (800 tests, 500 passed, 262 failed, 38 sk…
DavideD Jan 16, 2023
69c4f68
PostgreSQL results: FAILURE (800 tests, 523 passed, 239 failed, 38 sk…
DavideD Jan 16, 2023
2353798
Short is illegal for Identity value generation
DavideD Jan 17, 2023
9dce814
ORM 6.2.0-SNAPSHOT
DavideD Jan 17, 2023
4442004
Better error messaging + minor fixes
DavideD Jan 18, 2023
bba7947
PostgreSQL results: FAILURE (800 tests, 541 passed, 221 failed, 38 sk…
blafond Jan 18, 2023
170a4d1
Add ReactiveCteMutationStrategy
DavideD Jan 18, 2023
1b12e53
Update entity name in OrphanRemovalTest
DavideD Jan 18, 2023
c5a7ed5
Fix
DavideD Jan 18, 2023
897db48
fix
DavideD Jan 27, 2023
c37da1e
Fix
DavideD Jan 27, 2023
a549064
fix
DavideD Jan 27, 2023
2103447
Fix Stateless insert entity
DavideD Jan 30, 2023
d4cbd3d
fix
DavideD Jan 30, 2023
c877e0f
Format OneToManyTest code
DavideD Jan 31, 2023
4bae961
Remove OrderBy from OneToMany
DavideD Jan 31, 2023
893a583
Fix multiLoad ids
DavideD Jan 31, 2023
db8667d
Upgrade to ORM 6.2.0.CR2
DavideD Jan 31, 2023
9e308d3
Revert ORMReactivePersistenceTest
DavideD Jan 31, 2023
4e89682
Change HR version to 2.0.0-SNAPSHOT
DavideD Jan 31, 2023
f31b310
fix UTCTest: PostgreSQL results: FAILURE (804 tests, 610 passed, 156 …
blafond Feb 9, 2023
44a8ace
Fix MultilineImportsTest
geoand Feb 9, 2023
ca18888
Fix HQLQueryParameterPositionalTest
geoand Feb 10, 2023
a018b17
implementation and tests for createSelectionQuery() Stage session met…
blafond Feb 13, 2023
a7fc2b4
Fix CustomGeneratorTest
geoand Feb 14, 2023
3fa62f0
Fix CacheTest
geoand Feb 13, 2023
fff6dc5
Remove tests for entities with short id fields
geoand Feb 10, 2023
0ccaadd
Clean up ReactiveSessionTest
DavideD Feb 14, 2023
cc44df1
Clean up comments in UTCTest
DavideD Feb 14, 2023
621c8c1
Fix SubselectFetchTest
geoand Feb 14, 2023
add9baf
Fix MutinyExceptionsTest
geoand Feb 14, 2023
2fbb7dd
Fix HQLUpdateQueryTest
geoand Feb 15, 2023
53664fb
Fix LockOnUpdateTest
geoand Feb 15, 2023
57068f1
Fix implementation of ReactiveRowProcessingState
DavideD Feb 17, 2023
50561b4
Update to the latest ORM snapshot
DavideD Feb 17, 2023
30f1007
Fix compilation errors with ORM snapshot
DavideD Feb 20, 2023
d553242
Support @ValueGenerationType
geoand Feb 17, 2023
6d5896f
Fix CachedQueryResultsTest
geoand Feb 20, 2023
6316ff7
Introduce batch single table batch support
geoand Feb 21, 2023
073b385
Fix SecondaryTableTest
DavideD Feb 22, 2023
1639aad
Minor clean up and remove unsued classes
DavideD Feb 22, 2023
f2f4acb
Introduce some FetchType.EAGER support
geoand Feb 23, 2023
5afc9ff
Remove unneccesary overriding class: ReactiveJdbcSelect
Sanne Feb 23, 2023
64d332a
Avoid recursive wrapping of ReactiveResultSetMappingProcessor
Sanne Feb 23, 2023
195ce77
Update the ReactivePostgreSQLDialect to flag it as using a custom driver
Sanne Feb 23, 2023
ee08a20
Leverage HHH-16226 to avoid needing to customize SqlAstTranslatorFact…
Sanne Feb 24, 2023
8375a3b
Introduce ability to wrap an Hibernate ORM core Dialect
Sanne Feb 24, 2023
b2c5edc
Prefer postprocessing of SQL parameter style at the connection level
Sanne Feb 24, 2023
18c89ea
No longer need to override the SqlAstTranslatorFactory
Sanne Feb 24, 2023
2710143
Leverage HHH-16227 to plug custom SqmMultiTableMutationStrategy and S…
Sanne Feb 24, 2023
c22a8f3
ReactiveMutationExecutorPostInsert needs to implement ReactiveMutatio…
Sanne Feb 24, 2023
63d6c56
Disable LazyPropertyTest
geoand Feb 28, 2023
cd6744d
fix initialization of EmulatedSequenceReactiveIdentifierGenerator
Sanne Feb 27, 2023
a311e38
Fix FetchedAssociationTest
geoand Feb 28, 2023
a9ab99d
Work around lazy eager loading issue in clean DB for EagerUniqueKeyTest
geoand Feb 28, 2023
a2bac94
Work around lazy eager loading issue in clean DB for NonNullableManyT…
geoand Feb 28, 2023
02a1aa7
Work around lazy eager loading issue in clean DB for OneToOnePrimaryK…
geoand Feb 28, 2023
0121e6c
Work around lazy eager loading issue in clean DB for JoinedSubclassIn…
geoand Feb 28, 2023
e73565b
Properly pass input parameters in ReactiveJoinedSubclassEntityPersist…
geoand Feb 28, 2023
702fdf1
Implement ReactiveMutationExecutorPostInsert
geoand Mar 1, 2023
5e71abb
Work around lazy eager loading issue in clean DB for EagerOneToManyAs…
geoand Mar 1, 2023
2fbf375
Fix InsertOrderingReferenceSeveralDifferentSubclassBase tests
geoand Mar 1, 2023
56d41ef
Register new service: JdbcParameterRendererInitiator
DavideD Mar 1, 2023
f116a88
Upgrade to Hibernate ORM 6.2.0.CR3
Sanne Mar 1, 2023
16c611b
Delete GitHub actions for tracking snapshots
DavideD Mar 2, 2023
af07b20
Remove build of the examples in the workflow
DavideD Mar 2, 2023
16eea16
Skip tests in the CI workflows
DavideD Mar 2, 2023
827b65a
Disable maven local repository
DavideD Mar 2, 2023
80b119b
Clean up potential code problems
DavideD Mar 2, 2023
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
Prev Previous commit
Next Next commit
Fix Stateless insert entity
DavideD committed Mar 2, 2023

Verified

This commit was signed with the committer’s verified signature.
DavideD Davide D'Alto
commit 210344792fb0a2228fb6244942268286de8b2c50
Original file line number Diff line number Diff line change
@@ -6,47 +6,21 @@
package org.hibernate.reactive.id.impl;

import java.lang.invoke.MethodHandles;
import java.util.concurrent.CompletionStage;

import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.generator.Generator;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.reactive.id.ReactiveIdentifierGenerator;
import org.hibernate.reactive.logging.impl.Log;
import org.hibernate.reactive.logging.impl.LoggerFactory;
import org.hibernate.reactive.session.ReactiveConnectionSupplier;
import org.hibernate.type.descriptor.java.IntegerJavaType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.LongJavaType;
import org.hibernate.type.descriptor.java.ShortJavaType;
import org.hibernate.type.descriptor.java.StringJavaType;

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

public class IdentifierGeneration {

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

@SuppressWarnings("unchecked")
public static CompletionStage<Object> generateId(Object entity, EntityPersister persister, ReactiveConnectionSupplier connectionSupplier, SharedSessionContractImplementor session) {
Generator generator = persister.getGenerator();
return generator instanceof ReactiveIdentifierGenerator
? ( (ReactiveIdentifierGenerator<Object>) generator ).generate( connectionSupplier, entity )
: completedFuture( generator.generatesSometimes() );
}

public static Object assignIdIfNecessary(Object generatedId, Object entity, EntityPersister persister, SharedSessionContractImplementor session) {
if ( generatedId != null ) {
return castToIdentifierType( generatedId, persister );
}

Object assignedId = persister.getIdentifier( entity, session );
if ( assignedId == null ) {
throw LOG.idMustBeAssignedBeforeSave( persister.getEntityName() );
}
return assignedId;
}

public static Object castToIdentifierType(Object generatedId, EntityPersister persister) {
return generatedId instanceof Long
? castLongIdToIdentifierType( (Long) generatedId, persister )
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@
import org.hibernate.engine.spi.PersistentAttributeInterceptable;
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.generator.BeforeExecutionGenerator;
import org.hibernate.generator.Generator;
import org.hibernate.graph.GraphSemantic;
import org.hibernate.graph.internal.RootGraphImpl;
import org.hibernate.graph.spi.RootGraphImplementor;
@@ -64,6 +66,7 @@
import org.hibernate.reactive.common.AffectedEntities;
import org.hibernate.reactive.common.ResultSetMapping;
import org.hibernate.reactive.engine.impl.ReactivePersistenceContextAdapter;
import org.hibernate.reactive.id.ReactiveIdentifierGenerator;
import org.hibernate.reactive.logging.impl.Log;
import org.hibernate.reactive.logging.impl.LoggerFactory;
import org.hibernate.reactive.persister.collection.impl.ReactiveCollectionPersister;
@@ -94,9 +97,9 @@
import static java.lang.Boolean.TRUE;
import static org.hibernate.engine.internal.ManagedTypeHelper.asPersistentAttributeInterceptable;
import static org.hibernate.engine.internal.ManagedTypeHelper.isPersistentAttributeInterceptable;
import static org.hibernate.engine.internal.Versioning.seedVersion;
import static org.hibernate.generator.EventType.INSERT;
import static org.hibernate.internal.util.StringHelper.isEmpty;
import static org.hibernate.reactive.id.impl.IdentifierGeneration.assignIdIfNecessary;
import static org.hibernate.reactive.id.impl.IdentifierGeneration.generateId;
import static org.hibernate.reactive.persister.entity.impl.ReactiveEntityPersister.forceInitialize;
import static org.hibernate.reactive.session.impl.SessionUtil.checkEntityFound;
import static org.hibernate.reactive.util.impl.CompletionStages.completedFuture;
@@ -250,25 +253,30 @@ public ReactiveEntityPersister getEntityPersister(String entityName, Object obje
public CompletionStage<Void> reactiveInsert(Object entity) {
checkOpen();
ReactiveEntityPersister persister = getEntityPersister( null, entity );
return generateId( entity, persister, this, this )
.thenCompose( id -> {
Object[] state = persister.getPropertyValues( entity );
if ( persister.isVersioned() ) {
boolean substitute = Versioning
.seedVersion( state, persister.getVersionProperty(), persister.getVersionMapping(), this );
if ( substitute ) {
persister.setValues( entity, state );
Object[] state = persister.getPropertyValues( entity );
Generator generator = persister.getGenerator();
if ( !generator.generatedOnExecution() ) {
return generateId( entity, generator )
.thenCompose( id -> {
if ( persister.isVersioned() ) {
if ( seedVersion( state, persister.getVersionProperty(), persister.getVersionMapping(), this ) ) {
persister.setValues( entity, state );
}
}
}
return persister.insertReactive( id, state, entity, this )
.thenAccept( ignore -> persister.setIdentifier( entity, id, this ) );
} );
}

if ( persister.isIdentifierAssignedByInsert() ) {
return persister.insertReactive( state, entity, this )
.thenAccept( generatedId -> assignIdIfNecessary( entity, generatedId, persister, this ) );
}
id = assignIdIfNecessary( id, entity, persister, this );
persister.setIdentifier( entity, id, this );
return persister.insertReactive( id, state, entity, this );
} );
return persister.insertReactive( state, entity, this )
.thenAccept( id -> persister.setIdentifier( entity, id, this ) );
}

private CompletionStage<Object> generateId(Object entity, Generator generator) {
return generator instanceof ReactiveIdentifierGenerator
? ( (ReactiveIdentifierGenerator) generator ).generate( this, this )
: completedFuture( ( (BeforeExecutionGenerator) generator )
.generate( this, entity, null, INSERT ) );
}

@Override
@@ -581,7 +589,7 @@ else if ( isPersistentAttributeInterceptable( association ) ) {

}
else {
return CompletionStages.completedFuture( association );
return completedFuture( association );
}
}
else {