Code related to an article about configuration correctly the LAZY fetch mode in your Kotlin, Hibernate, SpringBoot project.
To enable LAZY fetch mode with Hibernate and Kotlin, don't forget to "open" your entities via the following configuration:
build.gradle.kts
allOpen {
annotation("javax.persistence.Entity")
annotation("javax.persistence.MappedSuperclass")
annotation("javax.persistence.Embeddable")
}
Are you sure the LAZY fetch mode is configured correctly in your Kotlin, Hibernate project?
./gradlew clean test --tests "com.leomillon.example.lazyfetchdemo.repository.CommentRepositoryTest.should get comment author"