https://github.com/leomillon/article-kotlin-hibernate-lazy-fetch
Code related to an article about configuration correctly the LAZY fetch mode in your Kotlin, Hibernate, SpringBoot project.
https://github.com/leomillon/article-kotlin-hibernate-lazy-fetch
hibernate jpa kotlin lazy-loading spring-boot
Last synced: 3 months ago
JSON representation
Code related to an article about configuration correctly the LAZY fetch mode in your Kotlin, Hibernate, SpringBoot project.
- Host: GitHub
- URL: https://github.com/leomillon/article-kotlin-hibernate-lazy-fetch
- Owner: leomillon
- Created: 2020-07-20T07:44:54.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-20T10:20:21.000Z (almost 5 years ago)
- Last Synced: 2025-01-15T05:53:16.014Z (5 months ago)
- Topics: hibernate, jpa, kotlin, lazy-loading, spring-boot
- Language: Kotlin
- Homepage: https://link.medium.com/hpa4LTIUg8
- Size: 58.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kotlin-Hibernate LAZY fetch demo
Code related to an article about configuration correctly the LAZY fetch mode in your Kotlin, Hibernate, SpringBoot project.
## Summary
To enable LAZY fetch mode with Hibernate and Kotlin, don't forget to "open" your entities via the following configuration:
`build.gradle.kts`
```kotlin
allOpen {
annotation("javax.persistence.Entity")
annotation("javax.persistence.MappedSuperclass")
annotation("javax.persistence.Embeddable")
}
```## Article
> Are you sure the LAZY fetch mode is configured correctly in your Kotlin, Hibernate project?
[Read it on Medium](https://link.medium.com/hpa4LTIUg8)
## Run the test
```shell script
./gradlew clean test --tests "com.leomillon.example.lazyfetchdemo.repository.CommentRepositoryTest.should get comment author"
```