One to Many Relationship in liferay using service bulider


Sometimes It is required to set relationship in liferay through the service.xml

 <entity name="Parent" local-service="true" remote-service="false">
<column name="ParentId" type="long" primary="true" />

                <column name="childReference" type="Collection" entity="ChildReference" mapping-key="ChildId" />
               -------------------
              -------------------

</entity>


 <entity name="Child" local-service="true" remote-service="false">
<column name="ChildId" type="long" primary="true" />
               -------------------
              -------------------

</entity>

Thats it you have set one-to-many relationship

Then build your service , to see the auto generated classes

Refer the ParentUtil class to see the mapping classes .

Comments

  1. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information..

    Mobile Application Development Training in Chennai

    ReplyDelete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

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