Pessoal estou tentando gerar um txt com minhas consultas sql, porem so estou conseguindo criar uma linha do banco no txt, alguem sabe como eu faço para gravar mais de uma linha obrigado:
public CurriculumVO[] find() throws DAOException, BusinessException{
String sql = SQL.SELECT_ALL ;
Collection list = new ArrayList(100);
try{
File arq1= new File("c:\\dados.txt");
this.openConnection();
ResultSet rs = this.executeSQL(sql);
while (rs.next()){
CurriculumVO user = new CurriculumVO();
user.setName(rs.getString("NAME"));
user.setEmail(rs.getString("EMAIL"));
user.setAddress(rs.getString("ADDRESS"));
user.setDistrict(rs.getString("DISTRICT"));
user.setComplement(rs.getString("COMPLEMENT"));
user.setCity(rs.getString("CITY"));
user.setState(rs.getString("STATE"));
user.setZipcode(rs.getString("ZIPCODE"));
user.setCountry(rs.getString("COUNTRY"));
user.setNationality(rs.getString("NATIONALITY"));
user.setBirthday(rs.getString("BIRTHDAY"));
user.setGender(rs.getString("GENDER"));
user.setCivilstate(rs.getString("CIVILSTATE"));
user.setNumberofchildren(rs.getString("NUMBEROFCHILDREN"));
user.setResidencialphone(rs.getString("RESIDENCIALPHONE"));
user.setComercialphone(rs.getString("COMERCIALPHONE"));
user.setComercialphoneext(rs.getString("COMERCIALPHONEEXT"));
user.setCelularphone(rs.getString("CELULARPHONE"));
user.setDegree(rs.getString("DEGREE"));
user.setCourse(rs.getString("COURSE"));
user.setEntity(rs.getString("ENTITY"));
user.setStatus(rs.getString("STATUS"));
user.setYearofconclusion(rs.getString("YEAROFCONCLUSION"));
user.setDegree1(rs.getString("DEGREE1"));
user.setCourse1(rs.getString("COURSE1"));
user.setEntity1(rs.getString("ENTITY1"));
user.setStatus1(rs.getString("STATUS1"));
user.setYearofconclusion1(rs.getString("YEAROFCONCLUSION1"));
user.setDegree2(rs.getString("DEGREE2"));
user.setCourse2(rs.getString("COURSE2"));
user.setEntity2(rs.getString("ENTITY2"));
user.setStatus2(rs.getString("STATUS2"));
user.setYearofcoclusion2(rs.getString("YEAROFCOCLUSION2"));
user.setCompanyname(rs.getString("COMPANYNAME"));
user.setLineofbusiness(rs.getString("LINEOFBUSINESS"));
user.setArea(rs.getString("AREA"));
user.setResponsibility(rs.getString("RESPONSIBILITY"));
user.setPosition(rs.getString("POSITION"));
user.setAdmissiondate(rs.getString("ADMISSIONDATE"));
user.setResignationdate(rs.getString("RESIGNATIONDATE"));
user.setCompanyname1(rs.getString("COMPANYNAME1"));
user.setLineofbusiness1(rs.getString("LINEOFBUSINESS1"));
user.setArea1(rs.getString("AREA1"));
user.setResponsibility1(rs.getString("RESPONSIBILITY1"));
user.setPosition1(rs.getString("POSITION1"));
user.setAdmissiondate1(rs.getString("ADMISSIONDATE1"));
user.setResignationdate1(rs.getString("RESIGNATIONDATE1"));
user.setCompanyname2(rs.getString("COMPANYNAME2"));
user.setLineofbusiness2(rs.getString("LINEOFBUSINESS2"));
user.setArea2(rs.getString("AREA2"));
user.setResponsibility2(rs.getString("RESPONSIBILITY2"));
user.setPosition2(rs.getString("POSITION2"));
user.setAdmissiondate2(rs.getString("ADMISSIONDATE2"));
user.setResignationdate2(rs.getString("RESIGNATIONDATE2"));
user.setWorkinginthemoment(rs.getString("WORKINGINTHEMOMENT"));
user.setOarea1(rs.getString("OAREA1"));
user.setOfunction1(rs.getString("OFUNCTION1"));
user.setOarea2(rs.getString("OAREA2"));
user.setOfunction2(rs.getString("OFUNCTION2"));
user.setEmploymentlevel(rs.getString("EMPLOYMENTLEVEL"));
user.setLocale(rs.getString("LOCALE"));
user.setIntendedsalary(rs.getString("INTENDEDSALARY"));
user.setTransferavailability(rs.getString("TRANSFERAVAILABILITY"));
user.setWindows(rs.getString("WINDOWS"));
user.setWord(rs.getString("WORD"));
user.setExcel(rs.getString("EXCEL"));
user.setPowerpoint(rs.getString("POWERPOINT"));
user.setOtherinfo(rs.getString("OTHERINFO"));
user.setEnglish(rs.getString("ENGLISH"));
user.setSpanish(rs.getString("SPANISH"));
user.setOtherlanguage(rs.getString("OTHERLANGUAGE"));
user.setOthercourse(rs.getString("OTHERCOURSE"));
user.setOthercourseentity(rs.getString("OTHERCOURSEENTITY"));
user.setOthercourseyearofconclusion(rs.getString("OTHERCOURSEYEAROFCONCLUSION"));
list.add(user);
String dados[] = {"|",user.getName(),"|",user.getEmail(),"|",user.getAddress(),"|",user.getDistrict(),"|",user.getComplement(),"|",user.getCity
(),"|",user.getState(),"|",user.getZipcode(),"|",user.getCountry(),"|",user.getNationality(),"|",user.getBirthday(),"|",user.getGender(),"|",user.getCivilstate
(),"|",user.getNumberofchildren(),"|",user.getResidencialphone(),"|",user.getComercialphone(),"|",user.getComercialphoneext(),"|",user.getCelularphone
(),"|",user.getDegree(),"|",user.getCourse(),"|",user.getEntity(),"|",user.getStatus(),"|",user.getYearofconclusion(),"|",user.getDegree1(),"|",user.getCourse1(),"|",user.getEntity1
(),"|",user.getStatus1(),"|",user.getYearofconclusion1(),"|",user.getDegree2(),"|",user.getCourse2(),"|",user.getEntity2(),"|",user.getStatus2(),"|",user.getYearofcoclusion2
(),"|",user.getCompanyname(),"|",user.getLineofbusiness(),"|",user.getArea(),"|",user.getResponsibility(),"|",user.getPosition(),"|",user.getAdmissiondate(),"|",user.getResignationdate
(),"|",user.getCompanyname1(),"|",user.getLineofbusiness1(),"|",user.getArea1(),"|",user.getResponsibility1(),"|",user.getPosition1(),"|",user.getAdmissiondate1(),"|",user.getResignationdate1
(),"|",user.getCompanyname2(),"|",user.getLineofbusiness2(),"|",user.getArea2(),"|",user.getResponsibility2(),"|",user.getPosition2(),"|",user.getAdmissiondate2(),"|",user.getResignationdate2
(),"|",user.getWorkinginthemoment(),"|",user.getOarea1(),"|",user.getOfunction1(),"|",user.getOarea2(),"|",user.getOfunction2(),"|",user.getEmploymentlevel
(),"|",user.getLocale(),"|",user.getIntendedsalary(),"|",user.getTransferavailability(),"|",user.getWindows(),"|",user.getWord(),"|",user.getExcel(),"|",user.getPowerpoint(),"|",user.getOtherinfo
(),"|",user.getEnglish(),"|",user.getSpanish(),"|",user.getOtherlanguage(),"|",user.getOthercourse(),"|",user.getOthercourseentity(),"|",user.getOthercourseyearofconclusion(),"|"};
FileWriter arq = new FileWriter(arq1);
PrintWriter saida = new PrintWriter(arq);
for(int i=0;i<dados.length;i++){
saida.print(dados[i]);
}
saida.close();
arq.close();
}
} catch (SQLException e) {
throw new DAOException(sql, e);
} catch (DAOException e) {
throw e;
} catch (SecurityException e) {
throw e;
} catch (FileNotFoundException e) {
}catch (IOException e) {
}
finally {
this.closeConnection();
}
return (CurriculumVO[]) list.toArray(new CurriculumVO[0]);
}