Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
asile elisa
many to many relationship
April 5, 2010 8:43 AM
Answer

asile elisa

Rank: Regular Member

Posts: 126

Join Date: February 17, 2010

Recent Posts

hi everyone

how do I declare a many to many relationship in service.xml
I have these tables:

Employer(EmployerId,EmployerName)
Entreprise(EntrepriseId,EntrepriseName)
work(EmployerId#,EntrepriseId#,date)

thanks in advance
Robson SARAIVA Ximenes
RE: many to many relationship
October 29, 2012 7:17 AM
Answer

Robson SARAIVA Ximenes

Rank: New Member

Posts: 10

Join Date: June 18, 2012

Recent Posts

Need this answer to..
Harish Kumar
RE: many to many relationship
October 30, 2012 12:52 AM
Answer

Harish Kumar

Rank: Expert

Posts: 471

Join Date: July 31, 2010

Recent Posts

Hi

Following is the description to implement many to many relationship in service.xml

 1
 2If 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.
 3
 4For example:
 5
 6<column name="roles" type="Collection" entity="Role" mapping-table="Groups_Roles" />
 7
 8The above column specifies that there will be a getter called pojo.getRoles() that will return a collection. It will use a mapping table called Groups_Roles to give a many to many relationship between groups and roles.
 9
10If you are creating a mapping table for an entity defined in another service.xml, you need to specify the full package path.


Extracted from service.xml dtd.


HTH