سؤال

I have a problem with Hibernate. I have three tables jobs, actions and mails. For jobs and actions there is a many-to-many relationship. So I created a join-table Action_Jobs which contains the ids of both tables.

Now, how can I build a relationship from the join-table Action_Jobs to my third table mails? Because from the combination of jobs and actions my mails are identified.

هل كانت مفيدة؟

المحلول

Create a new table Action_Jobs which maps Jobs to Action. Use the primary key of Action_Jobs table and map with Mails table. The primary key can be an auto increment column.

Hope this helps...

نصائح أخرى

You cannot join Action_Jobs table with other table because it is not Entity. According to your question, jobs, actions and mails are entities.Action_Jobs table is used to join actions and jobs table and not entity. So you should join mails table with jobs and actions tables directly.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top