I need to define an one-to-many relationship between my custom entity and a Liferay default entity DDMFormInstance. So one MyCustomEntity could have many DDMFormInstance's. How can I do it?
How to create one to many relationship using Liferay service builder
1.3k Views Asked by AudioBubble At
2
There are 2 best solutions below
0
On
André's answer works by repurposing a many-to-many relationship as a one-to-many relationship. The challenge here is that DDMFormInstance is an out of the box Liferay entity, you cannot add a foreign key to it for the one-to-many relationship. André's answer is the easiest solution. You define a many-to-many relationship in the service.xml using mapping-table, then make it behave as one-to-many relationship in your MyCustomEntityLocalServiceImpl class.
you can define collection style columns; furthermore you will need a mapping-table between
MyCustomEntityandDDMFormInstanceand also remember that service-builder is not an ORM tool, primarily. so there will be a time when out-of-the-box functionalities will end.see more in https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portal/service.xml