title: Difference between CrudRepository findOne() and JpaRepository getOne()
body: <p>I read that <code>getOne()</code> is lazy loaded and <code>findOne()</code> fetches the whole entity right away. I've checked the debugging log and I even enabled monitoring on my sql server to see what statements gets executed, I found that both <code>getOne()</code> and <code>findOne()</code> generates and executes the same query. However when I use <code>getOne()</code> the values are initially null (except for the id of course). </p>
  
  <p>So could anyone please tell me, if both methods executes the same query on the database, why should I use one over the other? I'm basically looking for a way to fetch an entity without getting all of its children/attributes.</p>
  
  <p><strong>EDIT1:</strong></p>
  
  <p><a href="http://pastebin.com/qkBk3aEh" rel="noreferrer">Entity code</a></p>
  
  <p>Dao code: </p>
  
  <pre><code>@Repository
  public interface FlightDao extends JpaRepository&lt;Flight, Long&gt; {
  }
  </code></pre>
  
  <p><a href="http://pastebin.com/fWaGE5yz" rel="noreferrer">Debugging log findOne() vs getOne()</a></p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>Thanks to Chlebik I was able to identify the problem. Like Chlebik stated, if you try to access any property of the entity fetched by <code>getOne()</code> the full query will be executed. In my case, I was checking the behavior while debugging, moving one line at a time, I totally forgot that while debugging the IDE tries to access object properties for debugging purposes (or at least that's what I think is happening), so debugging triggers the full query execution. I stopped debugging and then checked the logs and everything appears to be normal.</p>
  
  <p><code>getOne()</code> vs <code>findOne()</code> (This log is taken from MySQL <code>general_log</code> and not hibernate.</p>
  
  <p><a href="http://pastebin.com/PMzHTTxk" rel="noreferrer">Debugging log</a></p>
  
  <p><a href="http://pastebin.com/zN6azB74" rel="noreferrer">No debugging log</a></p>