Skip to content

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [com.example.entity.NewResult]] #2649

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

Closed
sankalpbhatt opened this issue Sep 30, 2022 · 2 comments
Assignees
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@sankalpbhatt
Copy link

sankalpbhatt commented Sep 30, 2022

Hi Team,

I am working on spring boot in Kotlin. I tried to create a custom query by joining tables. Needed a custom Entity class so created one.

Application starts but when I hit the query I get below error :
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [com.example.entity.NewResult]]

My Entity Class looks like:

data class NewResult(
    val sectionCode: String,
    val sectionDescription: String,
)

My repository class:

interface NewRepository: JpaRepository<SomeClass, UUID> {

    @Query(nativeQuery = true, value = """
        select 
            f.section_code as sectionCode, 
            m.section_description as sectionDescription
            from table1 f
                join table2 m on m.code_id = f.id
    """)
    fun search(): List<NewResult>
}

Please let me know if this is a bug in JPA

@sankalpbhatt sankalpbhatt changed the title org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [com.cogoport.saas.hs.entity.HsSearchResult]] org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [com.example.entity.NewResult]] Sep 30, 2022
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 30, 2022
@christophstrobl christophstrobl added the status: duplicate A duplicate of another issue label Oct 4, 2022
@jamesdh
Copy link

jamesdh commented Dec 9, 2022

Duplicate of #2008?

@gregturn
Copy link
Contributor

gregturn commented Apr 28, 2023

I believe the problem is attempting to mix native queries with projections and nested queries.

This situation appears too complicated for QueryUtils to handle, and we aren't likely to approve a change there that would meet your needs. Your best best moving forward may be to implement a custom implementation. Check out https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.custom-implementations for more details on how to hook such a solution into your repository.

@gregturn gregturn closed this as not planned Won't fix, can't repro, duplicate, stale Apr 28, 2023
@gregturn gregturn added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged status: duplicate A duplicate of another issue labels Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

5 participants