0

Please find sample inner class program below

public class Settlements
{public static class Event        
    {public static class EventInformation
        {public static class Inputs
        {public static class Cash
         {public static class CashType
           {public static class Security
            {public static class SecurityReference
              {public static class SecId
                {}
                }
            }
        }
    }
}

I am getting exception Invalid bean(Settlements.Event.EventInformation) when try to map inner class in the mapping file

<stream name="Stream" format="csv" >
   <group name="a" class="Settlements" collection="list" minOccurs="0" maxOccurs="unbounded">

     <record name="b"  class="Settlements.Event.EventInformation"  collection="list" minOccurs="0" maxOccurs="unbounded"></record>

     <record name="c"  class="Settlements.Event.Inputs.Security.SecurityReference.SecId"  collection="list" minOccurs="0" maxOccurs="unbounded"></record>   

     <record name="d"  class="Settlements.Event.Inputs.Security"  collection="list" minOccurs="0" maxOccurs="unbounded"></record>

     <record name="e"  class="Settlements.Event.Inputs"  collection="list" minOccurs="0" maxOccurs="unbounded"></record>
     <record name="f"  class="Settlements.Event.Inputs.Cash.CashType"  collection="list" minOccurs="0" maxOccurs="unbounded"></record>
    </group>
  </stream>

Could anyone please help on how to configure multiple inner class in the mapping file?

  • Is it really necessary for all those inner classes to be nested like that? It is really an indication of a badly designed system in my opinion. You can achieve the same result by just using simple POJO's and composition. – nicoschl Feb 10 '20 at 13:25
  • Also, you don't show any fields/attributes on the classes. Does each of the classes have a default (no argument) constructor? – nicoschl Feb 10 '20 at 13:26
  • Generated this class from a xsd file, currently checking multiple class generation by using xsd, then hope that will resolve my issue, let me post here if any issues. – vijay bharath Feb 11 '20 at 18:38

0 Answers0