title: How do I show this firebase database structure on a jTable?
body: <p>Im not sure how I can show this data on my jTable. Can anyone suggest me on how I can retrieve this firebase database structure. I dont have problem in jTable, its just how to access the nodes. Sorry for my bad english, hope you get my point.</p>
  
  <p><a href="https://i.stack.imgur.com/q2KyD.png" rel="nofollow noreferrer">Firebase Database Structure</a></p>
  
  <p>This is my code:</p>
  
  <pre><code>DatabaseReference getSubj = FirebaseDatabase.getInstance().getReference("Teachers").
              child(LoginFrame.sUserKey).child("Subjects");
      DefaultTableModel model = (DefaultTableModel) tblSubjects.getModel();
      Object[] row = new Object[4];
  
      getSubj.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot ds) {
              model.setNumRows(0);
              listSubjID.clear();
  
              for (DataSnapshot dataSnapshot : ds.getChildren()) {
                  Subject subject = new Subject();
  
                  subject.setSubjCode(dataSnapshot.child("Subject Details").child("subjCode").getValue().toString());
                  subject.setSubjTitle(dataSnapshot.child("Subject Details").child("subjTitle").getValue().toString());
                  subject.setUnits(dataSnapshot.child("Subject Details").child("units").getValue().toString());
                  subject.setSection(dataSnapshot.child("Subject Details").child("section").getValue().toString());
  
                  listSubjID.add(dataSnapshot.getKey());
  
                  row[0] = subject.getSubjCode();
                  row[1] = subject.getSubjTitle();
                  row[2] = subject.getUnits();
                  row[3] = subject.getSection();
  
                  model.addRow(row);
              }
          }
  
          @Override
          public void onCancelled(DatabaseError de) {
              throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
          }
      });
  </code></pre>