java - JPA composite foreign keys -


i have relationship cannot quite right in jpa. implementation hibernate.

i have these basic entities:

  • volunteer (personal details)
  • area (information work area)
  • session (time slot - start & end time)

there's many-to-many relationship between volunteer & session, volunteer_session, indicating volunteers willing work when.

there's many-to-many relationship between volunteer & area, volunteer_area, indicating volunteers willing work in areas.

there's many-to-many relationship between area & session, area_session additional column indicating how many volunteers needed in area during session.

so far, have relationships set correctly in jpa.

the next stage tricky - assignments.

volunteers may assigned area willing work in, during session willing work.

the table structure this:

assignment ---------- volunteer_id session_id area_id 

where volunteer_id , session_id comprise primary key, , foreign key volunteer_session table. also, volunteer_id , area_id should composite foreign key volunteer_area table.

i post code here, it's long question , point want add assignment, it's ok. post if requested.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -