The following is the configuration panel for a many to many page:
First, you can select the view type, i.e., how to display the selection choices; in the current version, only checkboxes can be used, but in future versions other modes may become available.
Then, you should select a database and an HQL query to execute on that database. The query must return only the entities that belong to the relationship; in the example, only those members - that is, the tuples (user, project) - that have mail notifications enabled. Before continuing with the next properties, you should save the configuration; this way, selection boxes will be populated like in the picture. Otherwise, you'll get simple text fields.
The next four properties are explained below:
- One expression - use this, in combination with 2., if you want one side of the relationship to be fixed. The value is a OGNL expression that provides the value for the property of point 2. In the example, the OGNL expression returns the ID of the currently logged in user, but it can refer to other objects, for examples variables established by ancestor CRUD pages.
- One property name - the name of the property that will be assigned the value of the expression defined in 1. It must be a valid property of the entity selected by the HQL query.
- One sp name - use this, instead of 1. and 2., if you want both sides of the relationship to be freely selectable by the user. The value of this property is a selection provider that controls both the available choices for the relationship and the property to set when the user chooses one of them. Note: selection providers that span multiple properties are not supported.
- Many sp name - same as 3., but for the opposite side of the relationship (the one rendered as a list of checkboxes).
To recap, options 1. and 2. are alternative to option 3. They decide whether one side of the relationships is fixed or not. Options 1. and 2. must be either both provided or both empty, and in the latter case, option 3. must be provided. Option 4. must always be provided.