@Test public void deleteUserWithAssignedRoles_shouldNotDeleteRolesAsWell() throws Exception { IdpRole role0 = new IdpRole(); role0.setRoleName("role0"); IdpRole role1 = new IdpRole(); role1.setRoleName("role1"); IdpUser user = createUser("testUser", role0, role1); em.getTransaction().begin(); em.persist(role0); em.persist(role1); em.persist(user); em.getTransaction().commit(); em.clear(); deleteUserIfExistent("testUser"); IdpRole fetchedAdminRole = em.find(IdpRole.class, role0.getId()); IdpRole fetchedManagerRole = em.find(IdpRole.class, role1.getId()); assertNotNull(fetchedAdminRole); assertNotNull(fetchedManagerRole); }
public int getId() { return id; }
IdpUser { public int getId() { return id; } }
IdpUser { public int getId() { return id; } IdpUser(); }
IdpUser { public int getId() { return id; } IdpUser(); int getId(); void setId(int id); String getUsername(); void setUsername(final String username); String getFirstName(); void setFirstName(final String firstName); String getLastName(); void setLastName(final String lastName); String getEmail(); void setEmail(final String email); String getPlainPassword(); void setPlainPassword(final String password); String getPassword(); void setPassword(String password); String getFullName(); List<IdpRole> getRoles(); void setRoles(final List<IdpRole> roles); IdpUserState getStatus(); void setStatus(IdpUserState status); String getActionToken(); void setActionToken(String actionToken); Date getDateCreated(); }
IdpUser { public int getId() { return id; } IdpUser(); int getId(); void setId(int id); String getUsername(); void setUsername(final String username); String getFirstName(); void setFirstName(final String firstName); String getLastName(); void setLastName(final String lastName); String getEmail(); void setEmail(final String email); String getPlainPassword(); void setPlainPassword(final String password); String getPassword(); void setPassword(String password); String getFullName(); List<IdpRole> getRoles(); void setRoles(final List<IdpRole> roles); IdpUserState getStatus(); void setStatus(IdpUserState status); String getActionToken(); void setActionToken(String actionToken); Date getDateCreated();  }