I'm working on one demo project which has Driver and Licenses connected ManyToMany. Driver can have more licenses and one license can be connected to more drivers. This is not a driver licence. The license I am talking about is connected with the cargo that they can, or cannot transport. That is the way it should be.
Recently, I had one request to add two extra fields in this connection. Driver and License are connected ManyToMany by table Drivers_License. That extra filed goes to Drivers_License and that is expirationDate, and stateIssued.
This is the look of my database now.
The problem is that I need to break ManyToMany connection and create two OneToMany connections. I also need composite key to be made from driverID and licenseID.
This is the example of that I am talking about.
Hibernate Many-to-Many Association with Extra Columns in Join Table Example
Can you tell me if there is some complete example how to finish this using spring and hibernate, or maybe do you know some example that can handle this by using ManyToMany on a classical way?