title: Should I use Kotlin data class as JPA entity?
body: <p>I am developing with Kotlin and JPA recently. 
  I use Kotlin data class as JPA @Entity class. </p>
  
  <p>But now, There comes some problem with relation </p>
  
  <pre><code>@ManyToOne(fetch = FetchType.LAZY, optional = true)
  </code></pre>
  
  <p>The lazy fetching doesn't work with data class.</p>
  
  <p>I have learned that Kotlin data class is default to be 'final' so that Hibernate can't generate proxy for them.</p>
  
  <p>I wonder is this a mistake to use Kotlin data class as JPA @Entity class or there is other ways to make the lazy fetching work properly with data class.</p>