code: public long deleteAll(final QueryableCriteria criteria) {
          return getHibernateTemplate().execute((GrailsHibernateTemplate.HibernateCallback<Integer>) session -> {
              JpaQueryBuilder builder = new JpaQueryBuilder(criteria);
              builder.setConversionService(getMappingContext().getConversionService());
              builder.setHibernateCompatible(true);
              JpaQueryInfo jpaQueryInfo = builder.buildDelete();
  
              org.hibernate.query.Query query = session.createQuery(jpaQueryInfo.getQuery());
              getHibernateTemplate().applySettings(query);
  
              List parameters = jpaQueryInfo.getParameters();
              if (parameters != null) {
                  for (int i = 0, count = parameters.size(); i < count; i++) {
                      query.setParameter(JpaQueryBuilder.PARAMETER_NAME_PREFIX + (i+1), parameters.get(i));
                  }
              }
  
              HibernateHqlQuery hqlQuery = new HibernateHqlQuery(HibernateSession.this, criteria.getPersistentEntity(), query);
              ApplicationEventPublisher applicationEventPublisher = datastore.getApplicationEventPublisher();
              applicationEventPublisher.publishEvent(new PreQueryEvent(datastore, hqlQuery));
              int result = query.executeUpdate();
              applicationEventPublisher.publishEvent(new PostQueryEvent(datastore, hqlQuery, Collections.singletonList(result)));
              return result;
          });
      }
docs: Deletes all objects matching the given criteria.
  
  @param criteria The criteria
  @return The total number of records deleted