title: JPA ManyToMany relation infinite loop
body: <p>I have two Entity objects ,whose fields are:</p>
  
  <blockquote>
    <p>Operation--> {id, name, applications}</p>
    
    <p>Application-->{id, name, operations}</p>
  </blockquote>
  
  <p>As u can see, both of these objects can include each others list, so I do that like </p>
  
  <pre><code>@ManyToMany(cascade={CascadeType.ALL},targetEntity=Operation.class)
  @LazyCollection(LazyCollectionOption.FALSE)
  @NotFound(action = NotFoundAction.IGNORE)
  @JoinTable(schema="RBMCORE",
            name="T_RBM_OPSCREENS_OPS_APPS",
            joinColumns={@JoinColumn(name="APP_ID", referencedColumnName="ID")},
            inverseJoinColumns={@JoinColumn(name="OP_ID", referencedColumnName="ID")})
  </code></pre>
  
  <p>other is </p>
  
  <pre><code>@ManyToMany(cascade={CascadeType.ALL},mappedBy="operations",targetEntity=Application.class)
  @LazyCollection(LazyCollectionOption.FALSE)
  @NotFound(action = NotFoundAction.IGNORE)
  </code></pre>
  
  <p>Each of them has a definition like this(vice versa about join column part). But when I do this it gives an exception like </p>
  
  <blockquote>
    <p>"sessions are not exist or already closed"</p>
  </blockquote>
  
  <p>.</p>
  
  <p>When I make LazyInit as false, it enters to infinite loop , which is not a surprise.(Spring says the problem is because of JSON conversion of the object but I think it is still related with JPA)</p>
  
  <p>What can I do about this problem? Any ideas will be appreciated.</p>