0

I want to know if it is possible to have Many to many relationships in service.xml in liferay 7.1.

I have my first entity : Service, that is linked to one or many "Zone" entity. So is it possible to do this in service.xml or i must create a relationship table (but not optimized for search and filter) ?

Thanks for your answers

Regards

DyM
  • 628
  • 1
  • 6
  • 16
  • See this answer, it's still valid: https://stackoverflow.com/a/24277423/379902 – Daniele Baggio Feb 28 '19 at 17:05
  • Ok, it works but i have a getCompanyId() method for my ServiceEntity that doesn't exist but it is called in generated method. Any solutions ? – DyM Mar 01 '19 at 07:34
  • For one-to-many relationships, you don't need an intermediary table: If "Zone" just has a "ServiceId", you'll end up with this relationship automatically. The `companyId` field is due to Liferay's semantics: It refers to a Liferay instance - you can host multiple completely separate portal instances in one installation and they're fully separated from each other. Typically what you want for content-types, and you'll be able to make use of it when you do permission checks. Otherwise you may want to ignore it - it'll be a single companyId if you just have one portal instance. – Olaf Kock Mar 01 '19 at 08:38
  • Do the mapping-table created auto or manual ? – DyM Mar 01 '19 at 09:50

0 Answers0