speedment / jpa-streamer

JPAstreamer is a lightweight library for expressing JPA queries as Java Streams
GNU Lesser General Public License v2.1
345 stars 35 forks source link

how do you configure JPAStreamer in gradle if your JPA model is written in Kotlin? #213

Open SchlauFuchs opened 2 years ago

SchlauFuchs commented 2 years ago

Hi!

It seems like if the JPA classes are written in Kotlin, adding the plugin to gradle does not result in generated sources. what do I need to do here?

minborg commented 2 years ago

The generation of the support classes is done using an annotation processor.

Perhaps this can provide some guidelines : https://kotlinlang.org/docs/ksp-overview.html

SchlauFuchs commented 2 years ago

Yes, I understood that with the annotation processor, and I added the processor dependency to the gradle build script according to the instructions. Still, I do not see anything trying to create generated code during the build - do you know if the JpaStreamer annotation processor interacts with the KSP?

On Fri, 14 Jan 2022 at 21:22, Per-Åke Minborg @.***> wrote:

The generation of the support classes is done using an annotation processor.

Perhaps this can provide some guidelines : https://kotlinlang.org/docs/ksp-overview.html

— Reply to this email directly, view it on GitHub https://github.com/speedment/jpa-streamer/issues/213#issuecomment-1012906736, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHK5HPKCNA2PCC3XS4PX5DUV7MNFANCNFSM5L5CAFVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

minborg commented 2 years ago

The annotation processor is only tested using Java. I am not a Kotlin expert but maybe the stage whereby Java code is inspected in the annotation processor does not exist during a Kotlin build? In that case, we should have to add some explicit support for KSP and Kotlin. Would it be possible for you to write one of your @Entity classes in Java and see if that works? I understand that this is not an ideal solution but this would perhaps allow a work-around?

SchlauFuchs commented 2 years ago

I cannot turn them to Java as it is company property and policy is to write Kotlin code... but I might have some time experimenting about the annotation processing in our IP sprint which comes in a few weeks.

On Fri, 14 Jan 2022 at 23:01, Per-Åke Minborg @.***> wrote:

The annotation processor is only tested using Java. I am not a Kotlin expert but maybe the stage whereby Java code is inspected in the annotation processor does not exist during a Kotlin build? In that case, we should have to add some explicit support for KSP and Kotlin. Would it be possible for you to write one of your @Entity classes in Java and see if that works? I understand that this is not an ideal solution but this would perhaps allow a work-around?

— Reply to this email directly, view it on GitHub https://github.com/speedment/jpa-streamer/issues/213#issuecomment-1012974246, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHK5HMB4B6CZRDFYKEBWVLUV7YBHANCNFSM5L5CAFVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

minborg commented 2 years ago

Understood. Let's check back in a few weeks and see.

Leokao4Autopass commented 11 months ago

I have a same problem, I want use jpa-streamer with kotlin project. any progress on this discussion?

update: I successful use it with kapt in quarkus

build.gradle.kts

plugins {
    kotlin("jvm") version "1.9.21"
    kotlin("plugin.allopen") version "1.9.21"
    kotlin("plugin.jpa") version "1.9.21"
    id("io.quarkus")
    kotlin("kapt") version "1.9.21"
}

dependencies {
    kapt("com.speedment.jpastreamer:fieldgenerator-standard:3.0.4")
}