Working support for simple restricted HQL DELETE -> execution!!

This commit is contained in:
Steve Ebersole 2019-11-08 18:35:42 -06:00
parent e6895c3d91
commit 59e4552195
2 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,7 @@ public class StandardSqlAstDeleteTranslator
appendSql( sqlAst.getTargetTable().getTableExpression() );
if ( sqlAst.getRestriction() != null ) {
appendSql( " where " );
sqlAst.getRestriction().accept( this );
}

View File

@ -29,4 +29,13 @@ public class HqlDeleteExecutionTests {
session -> session.createQuery( "delete BasicEntity" ).executeUpdate()
);
}
@Test
public void testSimpleRestrictedDelete(SessionFactoryScope scope) {
scope.inTransaction(
session -> session.createQuery( "delete BasicEntity where data = :filter" )
.setParameter( "filter", "abc" )
.executeUpdate()
);
}
}