-1

Anyone, kindly tell how to convert a java object or an array of objects to delimiter, fixedlength & unedifact file formats. the object may contain childs also.

SriKanth
  • 1
  • 2
  • Show us the code you have written so far. – Sanket Makani Jun 01 '17 at 06:13
  • Welcome to Stackoverflow, please edit your question to make it clearer what your asking and show us what you've tried and what isn't working. – Keith M Jun 01 '17 at 06:20
  • I didn't write any code, our application will load objects from db at runtime, those objects i have to convert to delimiter file format and send to the users. So that conversion logic i need – SriKanth Jun 01 '17 at 06:41

1 Answers1

0

OpenCsv (http://opencsv.sourceforge.net/) is very good to write POJOs to csv Files (Csv means comma separated values, but you can set almost any delimiter you want). OpenCsv even has Samples how to write a jdbc ResultSet into a csv file.

Maybe if you need the db data as Java-Objects, too, you might want to use JPA to load the entities and use OpenCsv to write it as a csv (it works well with annotations).

Dennux
  • 240
  • 1
  • 8