@Test public void testRemoveDataKeyThatDoesntExist() throws Exception { AppData appDataTestInstance = jpaAppDataMapper.findById(testAppDataId); jpaAppDataMapper.deleteAppDataValueByKey(appDataTestInstance.getId(), "nonexistent"); jpaAppDataMapper.flush(); getEntityManager().clear(); AppData appDataTestInstanceRemoved = jpaAppDataMapper.findById(testAppDataId); assertFalse("Data was not removed", appDataTestInstanceRemoved.getValues().containsKey("nonexistent")); }
public void deleteAppDataValueByKey(final long appDataId, final String appDataValueKey) throws Exception { int numResults = getEntityManager().createQuery( "delete from AppDataValue where name = :appDataValueKey" + " and appData.id = :appDataId") .setParameter("appDataValueKey", appDataValueKey).setParameter("appDataId", appDataId).executeUpdate(); if (numResults > 1) { throw new Exception("More than one item was deleted with this request and only one was expected."); } }
AppDataMapper extends DomainEntityMapper<AppData> { public void deleteAppDataValueByKey(final long appDataId, final String appDataValueKey) throws Exception { int numResults = getEntityManager().createQuery( "delete from AppDataValue where name = :appDataValueKey" + " and appData.id = :appDataId") .setParameter("appDataValueKey", appDataValueKey).setParameter("appDataId", appDataId).executeUpdate(); if (numResults > 1) { throw new Exception("More than one item was deleted with this request and only one was expected."); } } }
AppDataMapper extends DomainEntityMapper<AppData> { public void deleteAppDataValueByKey(final long appDataId, final String appDataValueKey) throws Exception { int numResults = getEntityManager().createQuery( "delete from AppDataValue where name = :appDataValueKey" + " and appData.id = :appDataId") .setParameter("appDataValueKey", appDataValueKey).setParameter("appDataId", appDataId).executeUpdate(); if (numResults > 1) { throw new Exception("More than one item was deleted with this request and only one was expected."); } } AppDataMapper(final QueryOptimizer inQueryOptimizer); }
AppDataMapper extends DomainEntityMapper<AppData> { public void deleteAppDataValueByKey(final long appDataId, final String appDataValueKey) throws Exception { int numResults = getEntityManager().createQuery( "delete from AppDataValue where name = :appDataValueKey" + " and appData.id = :appDataId") .setParameter("appDataValueKey", appDataValueKey).setParameter("appDataId", appDataId).executeUpdate(); if (numResults > 1) { throw new Exception("More than one item was deleted with this request and only one was expected."); } } AppDataMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") AppData findOrCreateByPersonAndGadgetDefinitionIds(final long gadgetDefinitionId, final String personId); void deleteAppDataValueByKey(final long appDataId, final String appDataValueKey); }
AppDataMapper extends DomainEntityMapper<AppData> { public void deleteAppDataValueByKey(final long appDataId, final String appDataValueKey) throws Exception { int numResults = getEntityManager().createQuery( "delete from AppDataValue where name = :appDataValueKey" + " and appData.id = :appDataId") .setParameter("appDataValueKey", appDataValueKey).setParameter("appDataId", appDataId).executeUpdate(); if (numResults > 1) { throw new Exception("More than one item was deleted with this request and only one was expected."); } } AppDataMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") AppData findOrCreateByPersonAndGadgetDefinitionIds(final long gadgetDefinitionId, final String personId); void deleteAppDataValueByKey(final long appDataId, final String appDataValueKey);  }