use of webpiecesxxxxxpackage.db.UserDbo in project webpieces by deanhiller.
the class CrudUserController method postDeleteUser.
public Redirect postDeleteUser(int id) {
UserDbo ref = Em.get().find(UserDbo.class, id);
List<UserRole> roles = ref.getRoles();
for (UserRole r : roles) {
Em.get().remove(r);
}
Em.get().remove(ref);
Em.get().flush();
Current.flash().setMessage("User deleted");
Current.flash().keep(true);
Current.validation().keep(false);
return Actions.redirect(CrudUserRouteId.LIST_USERS);
}
Aggregations