A mapping group contains mapped elements by target table (in a
relational database) or element (in an XML schema). There will be one query
that is generated for each mapping group. When you create a mapping, the mapping
editor tries to include that mapping in an existing mapping group. If there
is no appropriate mapping group the mapping editor creates a new mapping group.
The mapping target elements of a mapping group depend on the kind of schema
that you use on the target side.
- Relational schemas
- If you use a relational schema on the target side, a mapping group can
only span one table.
- XML schemas
- If you use an XML schema on the target side, your mapping group can span
multiple elements. A mapping group can only have one root element. but it
can point to multiple complex types beneath this root element. The mapping
group always refers to the root node to correspond to the generated XML document.
You can refine a mapping group by defining sort conditions, join conditions,
and filtering expressions on a mapping group. These conditions become the
WHERE clause or ORDER BY clause in the generated statement.
A mapping group is created automatically by the mapping editor when needed,
but you can also create a mapping group manually. You can also add a new complex
element or a table to an existing mapping group. For example, if the generated
mapping group does not include a table that is required based on some database
constraint, then you can manually add the table to the mapping group.