1

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>
Girish
  • 71
  • 1
  • 1
  • 4
  • Check if http://forum.spring.io/forum/spring-projects/batch/744929-build-non-trivial-xml-file-with-staxeventitemwriter can be good starting point – Luca Basso Ricci Jun 02 '14 at 12:38

1 Answers1

0

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!

Eric Nascimento
  • 381
  • 3
  • 15
  • Hey, could you please guide on http://stackoverflow.com/questions/36391219/bean-property-is-not-readable-or-has-an-invalid-getter-method-does-the-return-t/36391306?noredirect=1#comment60399566_36391306? – PAA Apr 04 '16 at 19:31