I'm working on an application using Spring Boot , so the UML class i was working with had 3 Entities :
- Admin(id,username,password,Email)
- Manager(id,username,password,Email,Phone)
- Client(id,username,password,Email,phone,Adresse)
the Admin has a mapping of one to many/ many to one with Manager also one to many/many to one with the entity Client .
After some researches i changed this to User/Role System , so the entity User has attributes like this :
public class AppUser implements Serializable {
@Id @GeneratedValue
private Long id;
@Column(unique = true)
private String username;
private String password;
@ManyToMany(fetch = FetchType.EAGER)
private Collection<AppRole> roles = new ArrayList<>();
}
And the Role Entity
public class AppRole implements Serializable {
@Id @GeneratedValue
private Long id;
private String roleName;
}
What should i do to implement the others entities , Manager and Client as they have other different attributes ?
and how i should implement the mapping now as there is only one Entity ?
thank you in advance.