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
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ private CompletionStage<?> generatedIdBeforeInsert(

private CompletionStage<?> generateIdForInsert(Object entity, Generator generator, ReactiveEntityPersister persister) {
if ( generator instanceof ReactiveIdentifierGenerator<?> reactiveGenerator ) {
return reactiveGenerator.generate( (ReactiveConnectionSupplier) this, this )
return reactiveGenerator.generate( (ReactiveConnectionSupplier) this, entity )
.thenApply( id -> castToIdentifierType( id, persister ) );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ public void populateDb(VertxTestContext context) {
test( context, getMutinySessionFactory().withTransaction( s -> s.persistAll( pizza, schnitzel ) ) );
}

@Test
public void testStatelessInsert(VertxTestContext context) {
LocationId nottingham = new LocationId( "UK", "Nottingham" );
Delivery mushyPeas = new Delivery( nottingham, "Mushy Peas with mint sauce" );
test( context, getMutinySessionFactory()
.withStatelessTransaction( s -> s.insert( mushyPeas ) )
.chain( () -> getMutinySessionFactory()
.withTransaction( s -> s.find( Delivery.class, nottingham ) )
)
.invoke( result -> assertThat( result ).isEqualTo( mushyPeas ) )
);
}

@Test
public void testFindSingleId(VertxTestContext context) {
test( context, getMutinySessionFactory().withTransaction( s -> s.find( Delivery.class, verbania ) )
Expand Down
Loading