Hi Kevin,
Thanks for replying.
I have one question for you, is there any limit on the number of time
a segment can repeat?
Here is an example:
public class Employee {
String firstName;
String lastName;
List aliasNames;
List hobbies;
}
Mapping.xml:
<beanio>
<stream name="employeeFile" format="fixedlength">
<record name="employee" class="com.sample.Employee">
<field name="firstName" length="100"/>
<field name="lastName" length="100"/>
<segment name="aliasNames" collection="list"
class="com.sample.AliasNames" minOccurs="999" maxOccurs="999">
<field name="akaFName" length="20"/>
<field name="akaLName" length="20"/>
</segment>
<segment name="hobbies" class="com.sample.Hobbies"
collection="list" minOccurs="2" maxOccurs="2">
<field name="name" length="20"/>
</segment>
</record>
</stream>
</beanio>
When I test the above code, I get this following error:
Exception in thread "main" org.beanio.BeanIOConfigurationException:
Invalid field 'name', in segment 'hobbies', in record 'employee', in
stream 'employeeFile': Cannot determine field position, field is
preceded by a component with indeterminate or unbounded occurences
When I change the minOccurs and maxOccurs of segment "aliasName" to
127 or swap the positions of segments "aliasNames" and "hobbies", I
dont get any exception.
example:
<stream name="employeeFile" format="fixedlength">
<record name="employee" class="com.sample.Employee">
<field name="firstName" length="100"/>
<field name="lastName" length="100"/>
<segment name="hobbies" class="com.sample.Hobbies"
collection="list" minOccurs="2" maxOccurs="2">
<field name="name" length="20"/>
</segment>
<segment name="aliasNames" collection="list"
class="com.sample.AliasNames" minOccurs="999" maxOccurs="999">
<field name="akaFName" length="20"/>
<field name="akaLName" length="20"/>
</segment>
</record>
</stream>
or
<stream name="employeeFile" format="fixedlength">
<record name="employee" class="com.sample.Employee">
<field name="firstName" length="100"/>
<field name="lastName" length="100"/>
<segment name="aliasNames" collection="list"
class="com.sample.AliasNames" minOccurs="127" maxOccurs="127">
<field name="akaFName" length="20"/>
<field name="akaLName" length="20"/>
</segment>
<segment name="hobbies"
class="com.sample.Hobbies" collection="list" minOccurs="2"
maxOccurs="2">
<field name="name" length="20"/>
</segment>
</record>
</stream>
Is there any restrictions that I am missing? How to address this
scenario? Is there any limitation on total size of the fixedlength
record?
Thank you in advance for you time.
Arcot.