Ejemplo n.º 1
0
  private void markAsInitiated() {
    Properties twentyFourDatabaseState = new Properties();
    twentyFourDatabaseState.setDb("basic");
    twentyFourDatabaseState.setState("Initiated");

    EntityTransaction tx = em.getTransaction();
    tx.begin();
    em.persist(twentyFourDatabaseState);
    tx.commit();
  }
Ejemplo n.º 2
0
  private boolean isInitiated() {
    boolean initiated = false;

    CriteriaQuery<Properties> query = em.getCriteriaBuilder().createQuery(Properties.class);
    List<Properties> propertiesList =
        em.createQuery(query.select(query.from(Properties.class))).getResultList();

    for (Properties properties : propertiesList) {
      if (properties.getDb().toString().equals("basic")
          && properties.getState().toString().equals("Initiated")) {

        initiated = true;
      }
    }

    return initiated;
  }