Class-based Projections (DTOs) id not working but Interface based projections is working

Viewed 393

I am using simple class based projections For native SQL explained here.
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#projections
But i am getting below exception

caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type

Value Object

@EqualsAndHashCode
@Value
public class MyClass{
    private String someName;
}

Repository

public interface MyRepository extends JpaRepository<MyClass,Long> {  
    @Query(value = "select SOME_NAME From Some_table where ID=1795463580",nativeQuery = true)
    public List<MyClass> getsomeName();

}

I removed lombok from MyClass, Still it does not works.

Now If i Change MyClass to Interface it works

 public interface MyClass{
        public String getSomeName();
    }
0 Answers
Related