Should I use Kotlin data class as JPA entity?
I am developing with Kotlin and JPA recently. I use Kotlin data class as JPA @Entity class. But now, there comes some problem with relation @ManyToOne(fetch = FetchType.LAZY, optional = true) The lazy fetching doesn't work with data class. I have learned that Kotlin data class is default to be 'final' so that Hibernate can't generate proxy for them. 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.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.