title: Spring boot JPA many to many asoociation with extra columns causing Multiple Bag exceptions
body: <p>Hello i am new to spring boot if you could help me out it would be really appreciated!!!</p>
  
  <p>Consider i have following tables</p>
  
  <p>buses
  routes
  bus_routes
  driver
  driver_routes
  busstop
  busstop_routes</p>
  
  <p>buses and routes has a connection table bus_routes with additional columns
  bus_routes structure
  id bus_id route_id created updated is_active</p>
  
  <p>As my knowlege using @ManytoMany is not possible because it has additional columns other than bus_id and route_id</p>
  
  <p>from the solutions i found up online i used joins following way</p>
  
  <p>Bus.java</p>
  
  <pre><code>@OneToMany(mappedBy = "bus", cascade = CascadeType.ALL)
  private List&lt;BusRoutes&gt; busRoutes;
  </code></pre>
  
  <p>BusRoutes.java</p>
  
  <pre><code>@Id
  @ManyToOne
  @JoinColumn
  private Bus bus;
  
  @Id
  @ManyToOne
  @JoinColumn
  private Route route;
  </code></pre>
  
  <p>Routes.java
  //As routes has connection with other three table</p>
  
  <pre><code>@OneToMany(mappedBy = "route", cascade = CascadeType.ALL)
  private List&lt;BusRoutes&gt; busRoutes;
  
  @OneToMany(mappedBy = "route", cascade = CascadeType.ALL,fetch = FetchType.EAGER)
  private List&lt;DriverRoutes&gt; driverRoutes;
  
  
  @OneToMany(mappedBy = "route", cascade = CascadeType.ALL,fetch = FetchType.EAGER)
  private List&lt;RouteBusStops&gt; routeStops;
  </code></pre>
  
  <p>so when i try to execute multiple bag exception,any ideas how to solve this??
  also can i fetch just contents of route yables without any bags??,is it possible??
  What is the most efficient method for many to many with extra columns???</p>