title: field access for lists of objects in a class via morphia in mongodb
body: <p>I have some problems while implementing filters in mongodb using morphia POJO mapper.  </p>
  
  <p>In my class (for example <code>SampleClass</code>), when i try to access the fields of  an <code>@Entity</code> class (in our case it's <code>Person</code>), I find the field access works fine, using dot notation for general fields like int, string, maps or direct embedded objects.</p>
  
  <p>The issue is I could not understand how it works for the case of a "List of Objects" referenced in the <code>Person</code> class. (Assume here, a person can have many addresses, so this <code>Person</code> class has a field <code>addresses</code> which holds a list of <code>Address</code> objects)</p>
  
  <pre><code>@Entity
  Class Person
  {
      String name;
      int age;
      String type;
      private Map&lt;String, String&gt; personalInfo= new HashMap&lt;String, String&gt;();
      @Reference
      List&lt;Address&gt; addresses = new ArrayList&lt;Address&gt;;
  }
  
  @Entity
  Class Address
  {
      String streetName;
      int doorNo;
  }
  </code></pre>
  
  <p>For example, I want to apply a filter on <code>streetName</code> of the <code>Address</code> object which is in the <code>addresses</code> List</p>
  
  <pre><code>public class SampleClass
  {  
      private Datastore ds;
      Query&lt;Node&gt;              query;
      CriteriaContainer        container;
  
      // connections params etc....
      public List&lt;Person&gt; sampleMethod()
      {
          query = ds.find( Person.class ).field( "type" ).equal( "GOOD");                              
  
          container.add( query.criteria( "name" ).containsIgnoreCase("jo" ));   
          // general String field in the Person Class ---- OKAY, Work's Fine
  
          container.add( query.criteria( "personalInfo.telephone" ).containsIgnoreCase( "458" ) ); 
          // Map field in the Person Class, accessing telephone key value in the map --- OKAY, Work's Fine
  
          container.add( query.criteria( "addresses.streetname").containsIgnoreCase( "mainstreet" ) ); 
          // List of address object in the Person Class, name of the field is 'addresses'
          // ----NOT OKAY   ????????? -- Here is the problem it returns nothing, even though some value exists
  
          return readTopography( query.asList() );
      }
  }
  </code></pre>
  
  <p>Am I doing something wrong while accessing the objects in a list?</p>