title: Java/Hibernate: How to detect, if field is lazy-loaded proxy and not actual data?
body: <p>I'm converting my entity to DTO and I want to set NULL as DTO value for all fields, which are lazy-loaded and not initialized (because I do not want to transfer all the data all the time).</p>
  
  <p>I've tried:</p>
  
  <pre><code>if (!(entity.getNationality() instanceof HibernateProxy))
      this.setNationalityFromEntity(entity.getNationality());
  </code></pre>
  
  <p>But it did not seemed to help.
  Any suggestions are welcome!</p>
  
  <p>Thank you!</p>