title: JPA returns many times the same object
body: <p>I'm trying to use JPA as a REST service using jax-rs. I'm trying to get all the values from an entity. In the db theres only one object, but this entity have a relationship one to many to other entity. Everything goes fine, but when I see the response in any RESTclient (I'm using POSTman) I get the same object many times.</p>
  
  <pre><code>@GET
  @Path("/by")
  @Produces(MediaType.APPLICATION_JSON)
  public List getAll() {
      Query q = entityManager.createQuery("select u from Entity u");
  
      List&lt;A&gt; x = q.getResultList();
      List&lt;A&gt; fg = new ArrayList&lt;A&gt;();
      for (int i = 0; i &lt; x.size(); i++) {
          A l = (A) x.get(i);
          l.getMonto();
          fg.add(l);
      }
      return fg;
  }
  </code></pre>