Many-to-Many relationship in liferay using service builder


Not only one-many relationship , we can also define many-to-many relationship using service builder


If the entity and mapping-key attributes are specified and mapping-table is not, then the Service Builder will assume you are specifying a one to many relationship.


For example:

<column
name="shoppingItemPrices"
type="Collection"
entity="ShoppingItemPrice"
mapping-key="itemId"
/>


If the entity and mapping-table attributes are specified and mapping-key is not, then the Service Builder will assume you are specifying a many to many relationship.

For example:

<column
name="roles"
type="Collection"
entity="Role"
mapping-table="Groups_Roles"
/>

The above items are mentioned in DTD of service.xml , Download the DTD for more details.




Comments

Popular posts from this blog

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate

Executing the BackGround Task