docs: protected final <T> CriteriaQuery<T> createCriteriaQuery(
              Function<CriteriaBuilder, CriteriaQuery<T>> builder) {
          final EntityManager entityManager = this.getEntityManager();
          final EntityManagerFactory entityManagerFactory = entityManager.getEntityManagerFactory();
          final CriteriaBuilder criteriaBuilder = entityManagerFactory.getCriteriaBuilder();
  
          final CriteriaQuery<T> criteriaQuery = builder.apply(criteriaBuilder);
  
          // Do in TX so the EM gets closed correctly
          final TransactionOperations transactionOperations = this.getTransactionOperations();
          transactionOperations.execute(
                  new TransactionCallbackWithoutResult() {
                      @Override
                      protected void doInTransactionWithoutResult(TransactionStatus status) {
                          entityManager.createQuery(
                                  criteriaQuery); // pre-compile critera query to avoid race
                          // conditions when setting aliases
                      }
                  });
  
          return criteriaQuery;
      }