OK.

So I first tried without the @OneToMany section for the lineItems and
successfully produced a TestHeader Object (using a shorter input stream)

When I put the OneToMany with a full length input stream I get the following
exception:

Size of the record: 756 is not equal to the value provided in the model: 126

(126 bytes of header + 10x 63 bytes of body = 756)

I was hoping it might produce as many TestBody objects as required.

Is OneToMany supported with FixedLengthRecord?

Using Camel 2.9.0-RC1

Here's the TestHeader class

@XmlRootElement //JAXB annotation
@XmlAccessorType(XmlAccessType.FIELD)
@FixedLengthRecord(length=126, paddingChar=' ')
public class TestHeader {
    
        @DataField(pos = 1, length = 4)
        private String RECORD_ID;

        @DataField(pos = 5, length = 1)
        private String ACTION;
    
        @DataField(pos = 6, length = 13)
        private String TRAN_NO;

        @DataField(pos = 19, length = 3)
        private String DATA_TYPE;
 
        @DataField(pos = 22, length = 6)
        private String TRAN_DEST;

        @DataField(pos = 28, length = 9)
        private String TRAN_SEQ_NO;
        
        @DataField(pos = 37, length = 8)
        private String RECORD_DATE;
        
        @DataField(pos = 45, length = 5)
        private String RECORD_TIME;
        
        @DataField(pos = 50, length = 2)
        private String COMP_CODE;

        @DataField(pos = 52, length = 30)
        private String CUST_NO;

        @DataField(pos = 82, length = 5)
        private String NO_LINE_ITEMS;

        @DataField(pos = 87, length = 15)
        private String ORD_NO;

        @DataField(pos = 102, length = 2)
        private String ORD_TYPE;

        @DataField(pos = 104, length = 7)
        private String ASSIGNMENT_NO;

        @DataField(pos = 111, length = 8)
        private String CUST_ORD_DATE;

        @DataField(pos = 119, length = 4)
        private String SOURCE_SYS;

        @DataField(pos = 123, length = 2)
        private String TPC_TYPE_CODE;
        
        @OneToMany
        private List<TestBody> lineItems;
        
}

and TestBody class

@FixedLengthRecord(length=63, paddingChar=' ')
public class TestBody {
        
        @DataField(pos = 1, length = 4)
    private String RECORD_ID;

        @DataField(pos = 5, length = 1)
        private String ACTION;
    
        @DataField(pos = 6, length = 8)
        private String RECORD_DATE;
        
        @DataField(pos = 14, length = 5)
        private String RECORD_TIME;

        @DataField(pos = 19, length = 6)
        private String ORD_LINE_NO;

        @DataField(pos = 25, length = 9)
        private String ORD_QTY;

        @DataField(pos = 34, length = 20)
        private String SKU;

        @DataField(pos = 54, length = 4)
        private String PKG_NO;

        @DataField(pos = 58, length = 2)
        private String UOM_ABBREV;

        @DataField(pos = 60, length = 2)
        private String DISTRO_TYPE;

        @DataField(pos = 62, length = 2)
        private String ITEM_TYPE;

}


--
View this message in context: 
http://camel.465427.n5.nabble.com/Bindy-and-FixedLength-tp5118749p5121740.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to