Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
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