How to return Json text from BD to ArrayList in Java

1

I'm having trouble converting a set of Json text from the database to a set of ArrayList text in Java. Here is the code below:

Model.java

public class Sala {
     private String professor;
     private ArrayList<Aluno> alunos;

     //gets e sets...
}

public class Aluno {
      private String nome;
      private String matricula;

      //gets e sets...
}

DAO.java

public ArrayList<Sala> obterInformacoesSala(){
     ...
     try{
        while(rs.next()){
            Sala s = new Sala();
            s.setProfessor(rs.getString("professor"));
            s.setAlunos(???); //tipo Json no BD
        }
     } catch { ... }
}
    
asked by anonymous 30.11.2017 / 22:41

0 answers