title: Retrieve data from Firebase. AddValueEventListener for complex object
body: <p>I am trying to use JAVA to read data from a Firebase database in an Android. I have a the following database: </p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "info" : {
      "about" : "...........",
      "address" : "...........",
      "bus" : "",
      "contact" : "........",
      "email" : ".........",
      "mobile_phone" : ".........",
      "trolley" : ""
    },
    "schedule" : {
      "47" : {
        "hall" : {
          "id" : 2,
          "name" : "..."
        },
        "presentation" : {
          "about" : "",
          "id" : 1,
          "title" : "....."
        },
        "section" : {
          "id" : 2,
          "name" : ".... "
        },
        "speakers" : [ 101 ],
        "time_end" : 0,
        "time_start" : 1416652800,
        "url" : "......"
      }
    }
  }
  </code></pre>
  
  <p>I can read simple structures, such as:</p>
  
  <pre><code>ref.child("info").addValueEventListener(new ValueEventListener() {
      @Override
      public void onDataChange(DataSnapshot dataSnapshot) {
  
         Info msg =dataSnapshot.getValue(Info.class);
         System.out.println(msg.getEmail());  
      }
  
      @Override
      public void onCancelled(FirebaseError firebaseError) {
  
      }
  });
  </code></pre>
  
  <p>But I don't know how to retrieve data from a structure "schedule". I tried to recreate POJO and read the structure, however it's not working.  </p>
  
  <pre><code>ref.child( "schedule" ).addValueEventListener( new ValueEventListener() {
      @Override
      public void onDataChange(DataSnapshot dataSnapshot) {
  
          for ( DataSnapshot postSnapshot : dataSnapshot.getChildren() ) {
              Schedule msg = dataSnapshot.getValue( Schedule.class );
              System.out.println( msg.getHall().getId() );
          }
  
  
      }
  
      @Override
      public void onCancelled(FirebaseError firebaseError) {
  
      }
  
  
  } );
  </code></pre>