title: LazyInitializationException when using ElementCollection in Play framework
body: <p>I have an User entity in my applications set of models that is defined as follows:</p>
  
  <pre><code>public class User extends Model {
  
      private String name;
  
      private byte[] sk;
  
      @Column(columnDefinition = "BINARY(272)")
      private byte[] pk;
  
      private int port;
  
      @OneToOne
      public Profile profile;
  
      @ElementCollection
      public List&lt;String&gt; friends;
  
      @ElementCollection
          public List&lt;String&gt; mirrors;
  ...
  }
  </code></pre>
  
  <p>and in a method in a different part of my application (a controller class) I am retrieving and attempting to modify the list of mirrors as follows:</p>
  
  <pre><code>    User u = User.connect(username);
      int port = ProfileFinder.getLocation(username, mirror);
      u.mirrors.remove(mirror);
      u.save();
  </code></pre>
  
  <p>This is throwing an error stating that:</p>
  
  <pre><code>LazyInitializationException occured : failed to lazily initialize a collection of role: models.User.mirrors, no session or session was closed
  </code></pre>
  
  <p>I suspect this is due to me misunderstanding some element of the <code>@ElementCollection</code> tag, but can anyone clarify how I could rectify this?</p>
  
  <p>Thanks.</p>