There are entiti in the project, between which are configured ManyToMany links. For example, Menu and Place. In the database, this data is stored in the place_has_menu table:
And everything is good, but only these tables are not used at all. They are simply listed in the database, but when you need to pull out all the menus, for some kind of place, they use joins, but they do not refer to this table. Is it worth it in this connection to change the connections between entiti like ManyToOne, OneToMany and remove these tables from the database? And even if you change the connections, how will the architecture change from this and will it be necessary for the ManyToOne and OneToMany connections of the table, as in the screenshot or will it reduce a little the base weight?
Update1 : Menu.class:
@Entity @Table(name="menu") public class Menu { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column private Long id; @JoinColumn(name="name") private String name; @ManyToMany(mappedBy="menus", cascade = CascadeType.ALL, fetch=FetchType.EAGER) private Set<Place> places = new HashSet<Place>(); // getter setters } Update2 There was still such a question. I have a method, for example:
public void addByForm(PlaceForm placeForm, MultipartFile multipartFile){ Place place = new Place(); PlaceType placeType = placeTypeDao.getById(placeForm.getTypeId()); place.setName(placeForm.getName()); place.setFile(fileService.saveFile(multipartFile, "place")); place.getPlaceTypes().add(placeType); placeType.getPlaces().add(place); } If you change the connection between the entities, will it affect the work of such methods? Or adding a delete slash will work on the same principle?
