title: Auto populating Set
body: <p>Is there anything like <code>AutoPopulatingList</code> but for <code>Set</code>?
  The data that I want to show is an association that uses <code>Set</code>.</p>
  
  <pre><code>public class Employer implements java.io.Serializable {
       private Set&lt;Employee&gt; employees = new HashSet();
  }
  </code></pre>
  
  <p>I've tried using <code>AutoPopulatingList</code> but in that case I have to use <code>List</code> in hibernate which needs me to specify <code>list-index</code> using <code>Employee.employeeId</code> and whenever I retrieve the <code>employees</code> through <code>Employee</code> later the list would have spaces between element (<code>null</code> elements) depending on the <code>Employee.employeeId</code>.</p>
  
  <p>I need to auto-populate the collection because I need to generate the <code>employees</code> dynamically while creating the <code>Employer</code>.
  I got the following when I use plain <code>Set</code>:
  <code>org.springframework.beans.InvalidPropertyException: Invalid property 'employees[0]' of bean class [model.Employer]: Cannot get element with index 0 from Set of size 0, accessed using property path 'employees[0]'</code></p>
  
  <p>Is there any other solution?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I'm trying to implement dynamic form</p>