wherehows-dao/src/main/java/wherehows/dao/table/BaseDao.java
@SneakyThrows
  public void executeUpdate(String queryStr, Map<String, Object> params) {
    EntityManager entityManager = entityManagerFactory.createEntityManager();
    try {
      Query query = entityManager.createQuery(queryStr);
      for (Map.Entry<String, Object> param : params.entrySet()) {
        query.setParameter(param.getKey(), param.getValue());
      }

      query.executeUpdate();
    } finally {
      entityManager.close();
    }
  }
/**
   * Execute an update or delete query String.
   * @param queryStr String
   * @param params Parameters
   */
Execute an update or delete query String.
@param queryStr String
@param params Parameters
Execute an update or delete query String . @param queryStr String @param params Parameters
@SneakyThrows
  public void executeUpdate(String queryStr, Map<String, Object> params) {
    EntityManager entityManager = entityManagerFactory.createEntityManager();
    try {
      Query query = entityManager.createQuery(queryStr);
      for (Map.Entry<String, Object> param : params.entrySet()) {
        query.setParameter(param.getKey(), param.getValue());
      }
      query.executeUpdate();
    } finally {
      entityManager.close();
    }
  }
@ SneakyThrows public void executeUpdate ( String queryStr , Map < String , Object > params ) { EntityManager entityManager = entityManagerFactory . createEntityManager ( ) ; try { Query query = entityManager . createQuery ( queryStr ) ; for ( Map . Entry < String , Object > param : params . entrySet ( ) ) { query . setParameter ( param . getKey ( ) , param . getValue ( ) ) ; } query . executeUpdate ( ) ; } finally { entityManager . close ( ) ; } }
Execute an update or delete query String.
Execute an update or delete query String .