0% found this document useful (0 votes)
21 views3 pages

Codigo en Java Consultajdbc

The method returns a list of object arrays containing data from various database tables to export defender person data to an Excel file. It executes a native SQL query to retrieve the data and then loops through the result set to populate cells in an Excel row with the values from each row of data.

Uploaded by

adan aguilar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Codigo en Java Consultajdbc

The method returns a list of object arrays containing data from various database tables to export defender person data to an Excel file. It executes a native SQL query to retrieve the data and then loops through the result set to populate cells in an Excel row with the values from each row of data.

Uploaded by

adan aguilar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

@Override

public List<Object[]> exportarDefensoresPersonaExcel() {

String cadprin = "select d.nid_persona,p.txt_constancia codigo_dna,


p.txt_nombre Descripcion_dna, t.txt_nombre funcion, x.txt_nombre profesion,"
+" d.txt_documento
DNI ,txt_apellido_paterno,txt_apellido_materno,txt_nombre1,txt_nombre2,txt_nombre3,
"
+
"d.TXT_SEXO,d.TXT_DIRECCION,d.TXT_CORREO,d.TXT_TELEFONO,d.TXT_COLEGIATURA,d.TXT_COL
EGIO,d.TXT_DOC_DESIGNACION, d.TXT_LUGAR_CURSO,d.TXT_FECHA_CURSO,"
+
"d.TXT_INPE,d.TXT_PJ,d.TXT_PNP,d.FLG_ACTIVO,EDAD,d.TXT_OBSERVACIONES,F_NOMBRAMIENTO
,"
+ "
NUMERO_CONCILIA,RESOLUCION,FECHA_RESOLUCION,ESTADO,ESTADO_DESCRIPCION,CODIGO_ESTADO
,y.txt_nombre modelo"
+ " from defensoria_persona d,defensoria p ,catalogo t,catalogo x,catalogo
y"
+ " where d.nid_dna = p.nid_dna"
+ " and d.nid_funcion =T.nid_catalogo"
+ " and d.nid_profesion =x.nid_catalogo"
+ " and P.nid_origen =y.nid_catalogo";

Query q = em.createNativeQuery(cadprin);

return q.getResultList();
}

List<Object[]> exportarDefensoresPersonaExcel() ;// agrego

Cell cell = row.createCell(colNum);

cell = row.createCell(0);
cell.setCellValue(getString(lista.get(i)[0]));//txt_constancia

cell = row.createCell(1);
cell.setCellValue(getString(lista.get(i)[1]));//txt_nombre

cell = row.createCell(2);
cell.setCellValue(getString(lista.get(i)[36]));//tipo

cell = row.createCell(3);
cell.setCellValue(getString(lista.get(i)[2]));//departamento

cell = row.createCell(4);
cell.setCellValue(getString(lista.get(i)[3]));//provincia

cell = row.createCell(5);
cell.setCellValue(getString(lista.get(i)[4]));//distrito

cell = row.createCell(6);
cell.setCellValue(getString(lista.get(i)[37]));//condicion

cell = row.createCell(7);
cell.setCellValue(getString(lista.get(i)[5]));//estado dna
cell = row.createCell(8);
cell.setCellValue(getString(lista.get(i)[6]));

cell = row.createCell(9);
cell.setCellValue(getString(lista.get(i)[7]));

cell = row.createCell(10);
cell.setCellValue(getString(lista.get(i)[8]));

cell = row.createCell(11);
cell.setCellValue(getString(lista.get(i)[9]));

cell = row.createCell(12);
cell.setCellValue(getString(lista.get(i)[10]));
cell = row.createCell(13);
cell.setCellValue(getString(lista.get(i)[11]));
cell = row.createCell(14);
cell.setCellValue(getString(lista.get(i)[12]));
cell = row.createCell(15);
cell.setCellValue(getString(lista.get(i)[13]));
cell = row.createCell(16);
cell.setCellValue(getString(lista.get(i)[14]));
cell = row.createCell(17);
cell.setCellValue(getString(lista.get(i)[15]));
cell = row.createCell(18);
cell.setCellValue(getString(lista.get(i)[16]));
cell = row.createCell(19);
cell.setCellValue(getString(lista.get(i)[17]));
cell = row.createCell(20);
cell.setCellValue(getString(lista.get(i)[18]));
cell = row.createCell(21);
cell.setCellValue(getString(lista.get(i)[19]));
cell = row.createCell(22);
cell.setCellValue(getString(lista.get(i)[20]));
cell = row.createCell(23);
cell.setCellValue(getString(lista.get(i)[21]));
cell = row.createCell(24);
cell.setCellValue(getString(lista.get(i)[22]));
cell = row.createCell(25);
cell.setCellValue(getString(lista.get(i)[23]));
cell = row.createCell(26);
cell.setCellValue(getString(lista.get(i)[24]));
cell = row.createCell(27);
cell.setCellValue(getString(lista.get(i)[25]));
cell = row.createCell(28);
cell.setCellValue(getString(lista.get(i)[26]));
cell = row.createCell(29);
cell.setCellValue(getString(lista.get(i)[27]));
cell = row.createCell(30);
cell.setCellValue(getString(lista.get(i)[28]));
cell = row.createCell(31);
cell.setCellValue(getString(lista.get(i)[29]));
cell = row.createCell(32);
cell.setCellValue(getString(lista.get(i)[30]));
cell = row.createCell(33);
cell.setCellValue(getString(lista.get(i)[31]));
cell = row.createCell(34);
cell.setCellValue(getString(lista.get(i)[32]));
cell = row.createCell(35);
cell.setCellValue(getString(lista.get(i)[33]));

cell = row.createCell(36);
cell.setCellValue(getString(lista.get(i)[34]));

cell = row.createCell(37);

List<Object[]> lista =
this.defensoriaPersonaFacade.exportarDefensoresPersonaExcel();

You might also like