private UserVariable create(User user, UserVariableKey key, String value) { EntityManager entityManager = getEntityManager(); UserVariable userVariable = new UserVariable(); userVariable.setUser(user); userVariable.setKey(key); userVariable.setValue(value); entityManager.persist(userVariable); user.getVariables().add(userVariable); entityManager.persist(user); return userVariable; }
private void updateValue(UserVariable userVariable, String value) { EntityManager entityManager = getEntityManager(); userVariable.setValue(value); entityManager.persist(userVariable); }