I want to read from DB and create a CSV file. In order to do that I am using camel-jdbc and camel-bindy.
First I set the body with the SELECT statement.
SELECT [vendor],
[ean],
[itemid] AS itemId,
[quantity]
FROM [dbo].[ElectronicDeliveryNotes]
then I call the jdbc component
<to uri="jdbc:dataSource?outputType=SelectList&outputClass=com.xxx.Model"/>
This will return a List of Model. Model class is
@CsvRecord(separator = ";", generateHeaderColumns = true, crlf = "UNIX")
public class Model2 {
@DataField(pos = 1, columnName = "A_Liererant")
private String vendor;
@DataField(pos = 2, columnName = "F_EAN")
private String ean;
@DataField(pos = 3, columnName = "G_Lief. Artikelnummer")
private String itemId;
@DataField(pos = 4, columnName = "H_Menge")
private BigDecimal quantity;
//getters setters
I am getting the following error:
java.lang.IllegalArgumentException: Cannot map all properties to bean of type class com.xxx.Model2. There are 1 unmapped properties. {itemid=11.0441-5402.2}
From my understanding the problem is in the naming of model properties. One solution that I tried and worked is to rename the Model itemId => itemid. This will work, but i am not using Java naming conventions.
Do you know how to overcome this without renaming properties?
I also tried the following but it didn't work.
@DataField(pos = 3, columnName = "G_Lief. Artikelnummer", name = "itemid")
private String itemId;