Skip to content

Commit 497a931

Browse files
committed
Test
1 parent b16b153 commit 497a931

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

+16
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,22 @@ void testSimpleMutationRestriction(SessionFactoryScope factoryScope) {
160160
assertThat( sqlCollector.getSqlQueries().get( 0 ) ).contains( " where be1_0.position between ? and ?" );
161161
}
162162

163+
@Test
164+
void testSimpleMutationRestrictionAsReference(SessionFactoryScope factoryScope) {
165+
final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector();
166+
var deleteBasicEntity = MutationSpecification
167+
.create( BasicEntity.class, "delete BasicEntity" )
168+
.restrict( Restriction.restrict( BasicEntity_.position, Range.closed( 1, 5 ) ) )
169+
.reference();
170+
factoryScope.inTransaction( session -> {
171+
sqlCollector.clear();
172+
session.createQuery( deleteBasicEntity ).executeUpdate();
173+
} );
174+
175+
assertThat( sqlCollector.getSqlQueries() ).hasSize( 1 );
176+
assertThat( sqlCollector.getSqlQueries().get( 0 ) ).contains( " where be1_0.position between ? and ?" );
177+
}
178+
163179
@Test
164180
void testRootEntityForm(SessionFactoryScope factoryScope) {
165181
final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector();

0 commit comments

Comments
 (0)