The following sections show how to implement CRUD views using two different designs: a Grid in editable mode, and modal windows. But first, we need to implement a domain model. We'll use JPA and repository classes, which we explained in the previous chapters. The domain model consists of simple classes to model a role-based schema: User, and Role. It also includes the corresponding UserRepository and RoleRepository classes.
Let's start with the simplest of the classes, Role. The following is the full implementation of this class:
@Entity
@Data
public class Role {
@Id
@GeneratedValue
private Long id;
private String name;
private Boolean module1Authorized;
private Boolean module2Authorized;
@Override
public String toString() {
return name;
}
}
Besides the usual JPA configuration stuff (such as the @Entity, @Id, and @GeneratedValue...