code: public long updateAll(final QueryableCriteria criteria, final Map<String, Object> properties) {
          return getHibernateTemplate().execute((GrailsHibernateTemplate.HibernateCallback<Integer>) session -> {
              JpaQueryBuilder builder = new JpaQueryBuilder(criteria);
              builder.setConversionService(getMappingContext().getConversionService());
              builder.setHibernateCompatible(true);
              PersistentEntity targetEntity = criteria.getPersistentEntity();
              PersistentProperty lastUpdated = targetEntity.getPropertyByName(GormProperties.LAST_UPDATED);
              if(lastUpdated != null && targetEntity.getMapping().getMappedForm().isAutoTimestamp()) {
                  if (timestampProvider == null) {
                      timestampProvider = new DefaultTimestampProvider();
                  }
                  properties.put(GormProperties.LAST_UPDATED, timestampProvider.createTimestamp(lastUpdated.getType()));
              }
  
              JpaQueryInfo jpaQueryInfo = builder.buildUpdate(properties);
  
              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, targetEntity, 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: Updates all objects matching the given criteria and property values.
  
  @param criteria The criteria
  @param properties The properties
  @return The total number of records updated