@ManyToAny sleep annotation

I cannot understand the use of @ManyToAny annotation in Hibernate. In that case, should it be used? I googled it, but the explanations in several websites just bounced over my head ...

Can anyone explain this with a simple example? How is this different from @ManyToMany and @ManyToOne?

+7
source share
1 answer

The javadoc says:

Defines a ToMany association that points to different types of entities. The type matching of the corresponding entity is performed using the metadata discriminator column. This type of display should only be marginal.

Thus, instead of meaningfully communicating between the student and the course, you may have a multi-valued between the student and [the course or teacher], and the metadata discriminator column will indicate for this row if it points to a course or teacher.

+12
source

All Articles