I have a legacy application that uses Hibernate, Spring Boot and Spring Data Rest and I’m trying to understand how the @ManyToMany
association is persisting data when written without any other join or mapping annotations?
The underlying database includes the tables person, project, person_projects
so a person can link to more than one project and a project can include more than one person.
The application includes entity objects for person and project but only the person object includes a @ManyToMany
annotation e.g.
@ManyToMany(cascade = { PERSIST, MERGE })
private Set<Project> projects;
That is all there is and I haven’t been able to find any other examples of a @ManytoMany
mapping written like this. Is this a valid shorthand way for writing a @ManyToMany
mapping and only including it in one entity object?