title: Freemarker HashMap loop having pojos
body: <p>i am having HashMap cars, and pojo Car contains attribute 'engines' which is again HashMap.</p>
  
  <pre><code>public class Car implements Serializable{
         private Long id;
         private String name;
         private Map&lt;Long,Engine&gt; engines = new HashMap&lt;&gt;();
         ..
         ..
  }
  public class Engine implements Serializable{
         private Long id;
         private String name;
  }
  </code></pre>
  
  <p>Freemarker model</p>
  
  <pre><code>final StringWriter sw = new StringWriter();
  Map model = new HashMap();
  model.put("cars",theCarsMap);
  Template tmpl = t.cfg.getTemplate("text.ftl");
  tmpl.process(model, sw);
  </code></pre>
  
  <p>Freemarker configuration</p>
  
  <pre><code>        cfg = new Configuration();
      cfg.setCacheStorage(new freemarker.cache.MruCacheStorage(20, 250));
      cfg.setClassForTemplateLoading(getClass(), ".");
      cfg.setObjectWrapper(new DefaultObjectWrapper());
  </code></pre>
  
  <p>Template Code:</p>
  
  <pre><code> &lt;#assign rKeys = cars?keys&gt;
   &lt;#list rKeys as rKey&gt;
   Car Details:${cars[rKey].getName()}\n
    --------------------------------------------------\n
   &lt;#assign engines = cars[rKey].getEngines()&gt;
   &lt;#assign tKeys = engines?keys&gt;
   &lt;#list tKeys as tKey&gt;
   ------------------Engine Details-----------------\n
   Name: ${engines[tKey].getName()}\n
   &lt;/#list&gt;
   &lt;/#list&gt;
  </code></pre>
  
  <p>I am getting following error:</p>
  
  <p>The problematic instruction:</p>
  
  <pre><code>${cars[rKey].getName()} [on line 3, column 18 in text.ftl]
  </code></pre>
  
  <p>Is there any thing special handling related to HashMap containing pojos and another Map?</p>