Symptom
Max field set size exceeded. Reason of that can be : too generic configuration, lack of properly defined BASIC field set level for data class, recurrency in data structure
Fields Configuration
The DataMapper supports field configuration, which means you are able to provide a list of fields you want to be mapped.
You can also create field levels, which are pre-configured sets (like BASIC, DEFAULT, FULL) to use later on while working with the mapper.
Examples of fields configuration:
String fields = "id,name,someList(innerField),nestedObject(FIELDSET_NAME)"; fields = "BASIC,additionalField"; fields = "someList(FULL),nestedObject(DEFAULT)"; |
Field Set Builder
The DefaultDataMapper uses a field set builder to parse the fields configuration.
The Builder creates a set of fields which should be mapped in the destination object based on:
- the given fields configuration.
- the destination object's class.
- the defined field levels.
The DefaultFieldSetBuilder class is defined in the webservicescommons extension, however the Spring bean should be defined in Web Services web context. It's because the Field Levels (pre-configured sets like BASIC, DEFAULT, FULL ) are automatically loaded by DefaultFieldSetBuilder and have to be in the same Spring context. There are two parameters which can influence how the field set builder works. The first defines how many recurrency levels should be supported by default (this is the case when a class has its own type field. For example, VariantMatrixElementData has fields that are also VariantMatrixElementData type). Fields after that recurrency level are omitted. The second parameter defines the maximum size of the created set of fields. If the limit is exceeded, an exception is thrown.
<alias alias="fieldSetBuilder" name="defaultFieldSetBuilder"/> <bean id="defaultFieldSetBuilder" class="de.hybris.platform.webservicescommons.mapping.impl.DefaultFieldSetBuilder"> <property name="defaultRecurrencyLevel" value="4"/> <property name="defaultMaxFieldSetSize" value="50000"/> <property name="fieldSetLevelHelper" ref="fieldSetLevelHelper"/> </bean> ... |
DestinationClass destination = dataMapper.map(sourceObject, DestinationClass.class, fields); // mapNulls parameter is useful while working with PATCH methods in order to populate only desired fields boolean mapNulls = false; dataMapper.map(anotherSourceObject, destination, fields, mapNulls); |
- Lists
List<DestinationElementClass> = dataMapper.mapAsList(iterableSource, DestinationElementClass.class, fields); |
- Sets
Set<DestinationElementClass> = dataMapper.mapAsSet(iterableSource, DestinationElementClass.class, fields); |
Read more...
Environment
SAP Commerce Cloud
Product
Keywords
Max field set size exceeded , KBA , CEC-SCC-PLA-APIR , API Registry , Problem
About this page
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.