Skip to Content
0
Former Member
Apr 09, 2015 at 02:58 PM

jaxbContextFactory with property wrapCollections=true does not wrap sub collections

116 Views

I am developing a rest service based on OCC. My output format is XML using the supplied jaxbContextFactory. By default all collections inside my main WsDTO are printed out as a flat list without an explicit surrounding tag:

 <product>
   <classifications>
     <code>CLASSIFICATION_1</code>
     <features>
       <code>FEATURE_1</code>
     </features>
     <features>
       <code>FEATURE_2</code>
     </features>
   </classifications>
   <classifications>
       ...
   </classifications>
   ...
 </product>

I need all collections to be wrapped in an extra xml-tag. So i defined the jaxbContextFactory's property 'wrapCollections' to TRUE. The result is...

 <product>
   <classifications>
     <classification>
       <code>CLASSIFICATION_1</code>
       <features>
         <code>FEATURE_1</code>
       </features>
       <features>
           <code>FEATURE_2</code>
       </features>
     </classification>
     <classification>
       ...
     </classification>
   </classifications>
   ...
 </product>

It works nicely for the classifications, but not for the inner features. As this is default hybris 5.5 code and the property is also provided by the template, i was hoping to get a consistent behavior for all collections.

How can i wrap all collections?