title: Hibernate : SetMaxResults not working with java.util.Map
body: <p>I am using Hibernate 3.0. Following is the criteria written for fetching data.</p>
  
  <pre><code>1. Criteria criteria = session.createCriteria(Document.class);
  2. criteria.setMaxResults(10);
  3. criteria.setFetchMode("metadata",FetchMode.join);
  4. criteria.setFetchMode("activitySchedules", FetchMode.JOIN);
  5. criteria.setFetchMode("activitySchedules.activities",FetchMode.JOIN); 
  6. criteria.setResultTransformer(criteria.DISTINCT_ROOT_PROPERTY);
  7. criteria.list();
  </code></pre>
  
  <p>In this criteria, <strong>setMaxResults(10)</strong> is not working. It is giving only 1 result for defined 10 limit. For 20 it is giving 2 and likewise.If I comment 4th line, the result is coming in proper manner. I am not getting this weird behavior. Is it the problem with fetching MAP ? If anybody knows about this let me know.</p>
  
  <p><strong>BeanStrucutre :</strong></p>
  
  <p><strong>Document.java</strong></p>
  
  <pre><code>private NormMaster metadata;
  
  private Map&lt;TransactionFlowEnum, ActivitySchedule&gt; activitySchedules;
  
   public NormMaster getMetadata(){
           return metadata;
  }
  
  public void setMetadata(NormMaster metadata){
     this.metadata = metadata;
  }
  
  public Map&lt;TransactionFlowEnum, ActivitySchedule&gt; getActivitySchedules() {
          return activitySchedules;
      }
  
   public void setActivitySchedules(
          Map&lt;TransactionFlowEnum, ActivitySchedule&gt; activitySchedules) {
          this.activitySchedules = activitySchedules;
      }
  </code></pre>
  
  <p><strong>ActivitySchedule.java</strong></p>
  
  <pre><code>private List&lt;Stage&gt; activities;
  
  public List&lt;Stage&gt; getActivities() {
      return activities;
  }
  
  public void setActivities(List&lt;Stage&gt; activities) {
      this.activities = activities;
  }
  </code></pre>
  
  <p><strong>NormMaster.java</strong></p>
  
  <pre><code>private String name;
  
  public void setName(String name){
   this.name = name;
  }
  
  public return getName(){
   return name;
  }
  </code></pre>
  
  <p><strong>Edit :</strong> If I am putting one more field in Document.java and fetching metadata excluding activitySchedules then the proper data is coming. </p>