Skip to content

Add test with stateless session for HHH-19386 #10087

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

Merged
merged 1 commit into from
Apr 29, 2025
Merged
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 @@ -176,6 +176,22 @@ void testSimpleMutationRestrictionAsReference(SessionFactoryScope factoryScope)
assertThat( sqlCollector.getSqlQueries().get( 0 ) ).contains( " where be1_0.position between ? and ?" );
}

@Test
void testSimpleMutationRestrictionStatelessAsReference(SessionFactoryScope factoryScope) {
final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector();
var deleteBasicEntity = MutationSpecification
.create( BasicEntity.class, "delete BasicEntity" )
.restrict( Restriction.restrict( BasicEntity_.position, Range.closed( 1, 5 ) ) )
.reference();
factoryScope.inStatelessTransaction( statelessSession -> {
sqlCollector.clear();
statelessSession.createQuery( deleteBasicEntity ).executeUpdate();
} );

assertThat( sqlCollector.getSqlQueries() ).hasSize( 1 );
assertThat( sqlCollector.getSqlQueries().get( 0 ) ).contains( " where be1_0.position between ? and ?" );
}

@Test
void testRootEntityForm(SessionFactoryScope factoryScope) {
final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector();
Expand Down
Loading