Java code to store result of procedure using JPA in a CSV file and save it in FTP Path without storing it in local computer

Viewed 141

JPA code :

List<Object[]> result=null;
try {
   em = getEntityManager();
   if(em != null){
     Query query = em.createNativeQuery("{call procedure Name('"+geoLocationName+"')}"); 
     result = query.getResultList(); 
   } else {
     logger.info("Connection is not successful");
   }
} catch (Exception ex) {
  logger.error("Error while fetching data from ::"+ex.getMessage());
} finally {
  if(em != null) {
     em.close();
  }
} 

I am reading a procedure by using the above code.

How can I write this result into a CSV file, which has to store into a FTP path without storing it locally ?

0 Answers
Related