Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPA projection getting 'is no accessor method' in 3.2.0-RC2 and Kotlin 1.9.20 #3221

Closed
estigma88 opened this issue Nov 8, 2023 · 4 comments
Assignees
Labels
status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged

Comments

@estigma88
Copy link

estigma88 commented Nov 8, 2023

Environment:

Spring Data JPA 3.2.0-RC2
Kotlin 1.9.20
JDK 21

Problem:

For a Koltin interface projection over a native Query, we are getting the following error when we try to access a property:

Invoked method public abstract java.lang.String com.example.issuejpakotlin.AggregateStats.getPipelineId() is no accessor method

The following is the Kotlin interface:

interface AggregateStats {
    fun getPipelineId(): String?
    fun getStdDevKbs(): Double?
}

And the JPA repository:

interface StatsJpaRepository : JpaRepository<StatsEntity, String> {

    @Query(
        value = """select pipeline_id as pipelineId,
                        stddev(bytes_in_rate) as stdDevKbs
                    from stats
                    where
                        pipeline_id in (?1)
                    group by pipeline_id""", nativeQuery = true
    )
    fun findAllStatsByIdIn(
        pipelineIds: List<String>
    ): List<AggregateStats>
}

How to reproduce:

We attached a Spring Boot project, you can run the test there.

Debugging:

Seems like the org.springframework.data.util.KotlinBeanInfoFactory class cannot find any accessor method in the interface.

This code works fine in Spring Boot 3.0.2 and Kotlin 1.9.20 where KotlinBeanInfoFactory class was not used.

Any help will be appreciated.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 8, 2023
@mp911de mp911de self-assigned this Nov 8, 2023
@mp911de
Copy link
Member

mp911de commented Nov 8, 2023

This looks like a duplicate of spring-projects/spring-data-commons#2964. Can you upgrade to the latest Spring Data snapshots (3.2.0-SNAPSHOT for spring-data-commons) and retest?

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Nov 8, 2023
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Nov 15, 2023
@estigma88
Copy link
Author

We will wait for the GA version to test this issue and come back to you

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Nov 15, 2023
@mp911de
Copy link
Member

mp911de commented Nov 15, 2023

Closing the issue until then.

@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants