Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12009

Bindy - Missing Headers from OneToMany Field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.19.5, 2.20.2, 2.21.0
    • camel-bindy
    • None
    • Unknown

    Description

      When generating a CSV header, the code doesn't follow the @OneToMany field and thus doesn't print its fields in the header. For example, when marshalling a list of Orders (List<Order>) where the classes are the ones below:

      @CsvRecord(separator = ",", generateHeaderColumns = true)
      public class Order {
      
          @DataField(pos = 1)
          private int orderNumber;
      
          @DataField(pos = 2)
          private String customerName;
      
          @OneToMany
          private List<OrderItem> items;
      }
      
      @CsvRecord(separator = ",", generateHeaderColumns = true)
      public class OrderItem {
      
          @DataField(pos = 3)
          private String sku;
      
          @DataField(pos = 4)
          private int quantity;
      
          @DataField(pos = 5)
          private int unitPrice;
      }
      

      we get the following header:
      orderNumber,customerName

      when, instead, we should be getting the following header:
      orderNumber,customerName,sku,quantity,unitPrice

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            khaledalturkestani Khaled AlTurkestani
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: