java - Using Camel Bindy in Has-A relationship -
hi have problem exporting java object csv file in camel. suppose if have java object namely student,
@csvrecord(separator=",") public class student { @datafield(pos=1) private string name; @datafield(pos=2) private string college; // getters , setters }
i export object csv file using below code in camel route,
.marshal(new bindycsvdataformat(camel.demo.book.class)) .to("file:data/destination?filename=book.csv")
but if have 1 more entity object named address in student object. , want print particular values of address along remaing student details in csv.
@csvrecord(separator=",") public class student { @datafield(pos=1) private string name; @datafield(pos=2) private string college; private address address; // getters , setters } public class address { private int houseno; private string street; private string city; //getters , setters }
now want save student details (name,college) , (city) address in csv. can please me achieve this. thank help.
use @link
annotation described here:
@csvrecord(separator=",") public class student { @datafield(pos=1) private string name; @datafield(pos=2) private string college; @link private address address; ... }
and class address
:
@link public class address { ... }
Comments
Post a Comment