File tree 1 file changed +16
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/query/dynamic
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,22 @@ void testSimpleMutationRestriction(SessionFactoryScope factoryScope) {
160
160
assertThat ( sqlCollector .getSqlQueries ().get ( 0 ) ).contains ( " where be1_0.position between ? and ?" );
161
161
}
162
162
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
+
163
179
@ Test
164
180
void testRootEntityForm (SessionFactoryScope factoryScope ) {
165
181
final SQLStatementInspector sqlCollector = factoryScope .getCollectingStatementInspector ();
You can’t perform that action at this time.
0 commit comments