private void markAsInitiated() { Properties twentyFourDatabaseState = new Properties(); twentyFourDatabaseState.setDb("basic"); twentyFourDatabaseState.setState("Initiated"); EntityTransaction tx = em.getTransaction(); tx.begin(); em.persist(twentyFourDatabaseState); tx.commit(); }
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; }