Search code examples
javahibernatehibernate-mapping

Hibernate mapping @manytomany


I got 3 tables: Bus, Driver and BusDriver and I need to get bus entity with set of drivers. I have already understood how to do this but there is a date field in BusDriver and I need to include it in set. For example I got {bus_id, bus_model, ... {driver1, driver2}} but I need {bus_id, bus_model, ... {{driver1, date}, driver2, date}}


Solution

  • You'll need to map the BusDriver table to an entity to get this attribute.

    You should do something like this exemplo