Hello Team,
I am working on a Liferay project using Service Builder to generate and manage our database tables.
Currently, we are defining relationships between entities using Service Builder by using the finder definitions. For example, if we have two entities with a parent-child relationship, we can define finders to retrieve the related records.
However, I understand that a Service Builder finder does not create an actual database-level Foreign Key (FK) constraint between the corresponding tables.
My questions are:
- Does Liferay Service Builder officially support creating database-level Foreign Key constraints between Service Builder entities?
- If yes, what is the official/recommended way to define such relationships in
service.xmlso that Service Builder generates the actual FK constraint in the database? - If Service Builder does not support database-level FK constraints, is there any officially supported or recommended alternative within the Liferay framework for creating database-level foreign key constraints?
- Most importantly, why does Liferay Service Builder not generate database-level Foreign Key constraints by default? Is there a specific architectural, portability, upgrade, or database compatibility reason for this design?