title: How could I decide how much data to load in JPA?
body: <p>I have a database with nodes that points to other nodes in parent children relationship and a lookup table to translate between web addresses and nodes.</p>
  
  <p>I need to get information about the node and it's parents and children but each time I fetch a node through the lookup table it only loads the data related to that node (name etc.) is there any way of go past this lazy loading and fetch more data?</p>
  
  <p>My data structures:</p>
  
  <pre><code>NodeLookup: 
      long id;   
      String url;  
      Node node;  
  
  Node:  
      long id;  
      String name;  
      List&lt;Node&gt; parents; //@ManyToMany  
      List&lt;Node&gt; childrens; //@ManyToMany  
  </code></pre>
  
  <p>Now I solve it by fetching a node through the NodeLookup table and use the node's id to fetch the node for real but that seems like a waste of resources.</p>
  
  <p>(I'm using the play framework)</p>