Skip Headers

# Using Java

Previous

Next

Use `AbstractCompositeDirectCollectionMapping` method `setUsesSingleNode` to configure the mapping to write a list value to a single node by passing in a value of `true`. To configure the mapping to write a list value to multiple nodes, pass in a value of `false`.

For any mapping that takes an `XMLField`, use `XMLField` method `setUsesSingleNode` to configure the mapping to write a list value to a single node by passing in a value of `true`. To configure the mapping to write a list value to multiple nodes, pass in a value of `false`. Example: Using XMLField Method setUsesSingleNode shows how to use this method with an `XMLDirectMapping`:

Using XMLField Method setUsesSingleNode

    XMLDirectMapping tasksMapping = new XMLDirectMapping();
    tasksMapping.setAttributeName("tasks");
    XMLField myField = new XMLField("tasks/text()"); // pass in the XPath
    myField.setUsesSingleNode(true);
    tasksMapping.setField(myField);