Childproperty (attribute of property)

From JRapid

(Redirected from Childproperty)
Jump to: navigation, search

Childproperty indicates the field by which two entities will be related. It is required when the property is of type collection and embedded.


              name = NAME label = LABEL 
              collection = "set | sortedset | list" 
              embedded = "inline | detail"  
              childproperty = CHILDPROPERTY />
  • childproperty: the property by which to entities are connected.


In this example a "User" entity has a collection of "photos" of type entity "Photo". If we want a photo to belong to only one user then we should connect both entities using the childproperty attribute. A one-to-many relationship is created.

 <entity name="Photo" label="Photo">
 	<property name="user" label="User" entity="User" display="primary">
 	<property name="picture" label="Picture" type="image" width="600"/>
 	<property name="thumb" label="Thumb" imagecopyof="image" width="90" height="90" type="image"/>
 	<property name="postedDate" label="date" type="date" default="now"/>
 <entity name="User" label="User">
 	<property name="firstName" label="First Name" display="primary" required="required"/>
 	<property name="lastName" label="Last Name" display="primary" required="required"/>
 	<property name="photos" label="Photos" entity="Photo" collection="set" embedded="inline"  
         childproperty="user" extendable="extendable"/>
Personal tools