0
votes

I have to design a spring batch job which reads from database and write the data in to XML the output format is as follows.

Please suggest the spring batch configuration for Reader and writer.

<Report>
<ContentLocation>I0001</ContentLocation>
    <Header documentId="Doc1">
      <Mark>e-mark</Mark>
      <EndDate>2014-04-30 00:00:00</EndDate>
      <Type>109</Type>
      <Business>
        <Id>123456789</Id>
        <LegalName>Company</LegalName>
        <LegalAddress>12345 Main St. JamesTown CA 92869</LegalAddress>
        <LegalPhoneNumber>567-678-8909</LegalPhoneNumber>
      </Business>
    </Header>
<ITD documentId="34">
<Client>
   <Name>Client1</Name>
   <Address>Address1</Address>
</Client>
<Associate>
   <Id>1</Id>
   <Department>Finance</Department>
</Associate>
<Associate>
   <Id>2</Id>
   <Department>Accounts</Department>
</Associate>
</Itd>
</Report>
1

1 Answers

0
votes

in your case i suggest this Mkyong tutorial, is detailed and very simple.

http://www.mkyong.com/spring-batch/spring-batch-example-mysql-database-to-xml/

also if your data retrieved from database are represented as entity in java you can use spring batch with Xstream, i can help you just let me know what way you want go.

See Ya!