How to do a many-to-many relationship in spring Roo, with attributes within de relationship?

前端 未结 2 1670
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 08:45

i have been researching on this topic and havent found any answers yet. Im using spring roo and i would like to know if theres a way I can establish a many-to-many relations

2条回答
  •  悲&欢浪女
    2021-01-03 09:09

    Why can't you have a separate entity to denote your relationship?

    Just introduce a new entity called a MedicalEquipmentReservation which would contain all the attributes of the reservation along with the relationships between the Employee and the Medical Equipment entities.

    See the following example.

    class MedicalEquipmentReservation{  
        //attributes  
        Date reservationStartDate;    
        Date reservationEndDate; 
    
        //relationships
        Employee employee; 
        Set equipments; //assuming more than one equipment can be borrowed at one reservation
    }
    

    Cheers and all the best with Spring Roo!

提交回复
热议问题