D
D
Dmitry Belousov2016-10-01 11:53:58
Java
Dmitry Belousov, 2016-10-01 11:53:58

What does @ManyToMany mean?

Please explain what this code means:

@ManyToMany(mappedBy = "roles")
    private Set<User> users;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Garansky, 2016-10-01
@dreven

Many-to-many relationship.
Specifically in your example: each user can have multiple roles, and multiple people can be assigned to each role.
Example
Vasya has 2 roles in your system: editor, administrator
At the same time, there may be other administrators in the system.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question