I have two classes CommonRequest and AccountRequest
@FixedLengthRecord(paddingChar=' ',ignoreTrailingChars=true)
public class CommonRequest {
@Id
private String corelationID;
@DataField(pos=1,length=8)
private String cmNumber;
@DataField(pos=2,length=16)
private String accountNumber;
}
And AccountRequest.java
@FixedLengthRecord(paddingChar=' ',ignoreTrailingChars=true)
public class AccountRequest extends CommonRequest {
@Id
private String corelationID;
@DataField(pos=3,length=14)
private String accountType;
@DataField(pos=4,length=15)
private String accountLocation;
}
When I tries to unmarshall a record like cmNumberaccountNumberaccountTypeaccountLocation
It unmarshall common request properly but when i tries to unmarshall AccountRequest it takes the position from start instead of continuing it from the position left in common request.
And this mismatches whole fields in the AccountRequest.
Change the position to match the lengths , but still you will not have the fields in the base class set , they will be null, but the child class fields will be set . Check this site to see how it can be done.http://people.apache.org/~dkulp/camel/bindy.html