em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
if (type == ResourceType.EXPERIMENT) {
QueryGenerator generator = new QueryGenerator(EXPERIMENT);
generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
Query q = generator.deleteQuery(em);
q.executeUpdate();
} else if (type == ResourceType.PROJECT_USER) {
QueryGenerator generator = new QueryGenerator(PROJECT_USER);
generator.setParameter(ProjectUserConstants.USERNAME, name);
generator.setParameter(ProjectUserConstants.PROJECT_ID, this.id);