I have a list of objects (result from a select query), I want to convert it into an array and I want to put each column of the query in a column in the array. I have tried many solutions in the forum but I haven't found a solution.
In my bean I have the following list:
private List<PhBonCmd> listEntree; // The PhBonCmd is an object model imported has attributes like codeprod , quant ,...
.....
String sql ="select c.codeprod as codeprod , c.quant as quant ,c.date_cmd as date_cmd, c.date_expir as date_expir,c.numbco as numbco, c.auteur as auteur,"
+"c.idcmd as idcmd ,f.nomfourn as nomfourn ,coalesce(c.quant_livre, 0) as quant_livre ,m.libelle as libelle "
+"from commandes c,listeproduit m,fournisseur f "
+"where c.codeprod=m.codeproduit and c.fourn=f.idfourn and c.statut='IN' and c.numbco ='"+getNumbco()+"' ";
listEntree = (List<PhBonCmd>) this.bcService.execRequete(sql);//Here the results of the sql query
Now what I want is to put each column of the List (listEntree
) in a multidimensional arraylist, so as if I want to access to a specific single value in of the arraylist, I do so.