The above database design is not how you should store roles for the user. This is not standardized (since you have multiple values ββin one column), and therefore it is very difficult to query. How could you ask a query to find out all users who have guest or ap roles, for example?
Change the design to something like this:
user table : id, name, passord role table: id, name user_role join table: user_id, role_id
In terms of JPA, you will simply have a User object, a Role object, and a ManyToMany association between these objects: the user has 0, 1 or more roles, and the role is held by 0, 1 or more users.
source share