Skip to content

Commit 7ab82b2

Browse files
committed
HHH-19386 Add test with stateless session
1 parent 6dc2e7b commit 7ab82b2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/query/dynamic/SimpleQuerySpecificationTests.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,22 @@ void testSimpleMutationRestrictionAsReference(SessionFactoryScope factoryScope)
176176
assertThat( sqlCollector.getSqlQueries().get( 0 ) ).contains( " where be1_0.position between ? and ?" );
177177
}
178178

179+
@Test
180+
void testSimpleMutationRestrictionStatelessAsReference(SessionFactoryScope factoryScope) {
181+
final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector();
182+
var deleteBasicEntity = MutationSpecification
183+
.create( BasicEntity.class, "delete BasicEntity" )
184+
.restrict( Restriction.restrict( BasicEntity_.position, Range.closed( 1, 5 ) ) )
185+
.reference();
186+
factoryScope.inStatelessTransaction( statelessSession -> {
187+
sqlCollector.clear();
188+
statelessSession.createQuery( deleteBasicEntity ).executeUpdate();
189+
} );
190+
191+
assertThat( sqlCollector.getSqlQueries() ).hasSize( 1 );
192+
assertThat( sqlCollector.getSqlQueries().get( 0 ) ).contains( " where be1_0.position between ? and ?" );
193+
}
194+
179195
@Test
180196
void testRootEntityForm(SessionFactoryScope factoryScope) {
181197
final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector();

0 commit comments

Comments
 (0)