File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/query/dynamic Expand file tree Collapse file tree 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) {
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 ();
You can’t perform that action at this time.
0 commit comments