Hi All,
Well I spent a few hours on this today trying to understand how to do this.
What I did was to change my splitter to do this...
public List<ItemDocuments> splitItemsRootDocuments(ItemRootDocument
doc) {
List<ItemDocuments> itemDocuments = doc.getItemDocumentsList();
return itemDocuments;
}
It returns both items 93501250080 and 93501250090.
Then I changed my converter...
public class ItemTransformer {
@Converter
public ItemEntity toItem(ItemDocuments docs, Exchange exchange)
throws Exception {
JpaTemplate template =
exchange.getIn().getHeader("CamelJpaTemplate", JpaTemplate.class);
List<ItemEntity> items = new ArrayList<ItemEntity>();
List itemDocs = docs.getItemDocumentList();
for (Iterator i = itemDocs.iterator(); i.hasNext();){
ItemDocument doc = (ItemDocument)i.next();
String itemNo = doc.getItemNo();
ItemEntity item = new ItemEntity();
item.setItemNo(itemNo);
item.setDescription(doc.getDescription());
}
return items;
}
to return a list of ItemEntity's. (i.e. not just the one). Does this seem
like the right approach. I thinking it is.
The only error I have now is ...
No type converter available to convert from type:
org.apache.camel.example.etl.ItemDocuments to the required type:
org.apache.camel.example.etl.ItemEntity
Because I'm now returning a list of ItemEntity objects instead of just the
single one. I don't know how to fix this yet but will try to find out.
Comments to tell me if I am heading down the right track would be much
appreciated.
thanks
--
View this message in context:
http://camel.465427.n5.nabble.com/JPA-component-Persist-1-record-working-but-how-to-persist-many-records-tp5742267p5742269.html
Sent from the Camel - Users mailing list archive at Nabble.com.