Support for collection mapping in JOIN Statements with Java annotations
tttol opened this issue · 2 comments
Are there any plans to support collection mapping in JOIN Statements with Java annotations?
I would like to complete it with just a .java file without using XML file.
It says below that it is not possible due to MyBatis limitation, but what exactly are MyBatis limitation?
Please tell me detal information.
Here's a link to MyBatis docs where this is mentioned: https://mybatis.org/mybatis-3/java-api.html#:~:text=A%20mapping%20to%20a%20collection,not%20allow%20for%20circular%20references
Caution: You can accomplish annotation based collection mappings with lazy loading, but there are a lot of drawbacks to that approach because it causes multiple trips to the database and may make performance worse. However, I mention it because it is possible. Here's a Kotlin based example of lazy loading: https://github.com/jeffgbutler/mybatis-kotlin-examples/blob/master/src/main/kotlin/example04/lazy/Example04LazyMapper.kt
Thank you for the detailed information.
It's possible with lazy loading. However, if performance deteriorates, I think I'll stop using it.