I have a simple native query in my repository
@Query(value = "select * from COUNTRY c where c. COUNTRY_C = ?1", isNative =
true)
public abstract List<Country> findCountryByCode(String countryCode);
I execute it by the following line –
List<Country> countryList =
this.countryRepository.findCountryByCode(this.countryCode);
I see the right query being executed –
[EL Finest]: query: Execute query DataReadQuery(sql="select * from COUNTRY c
where c. COUNTRY_C = ?1")
And my list contains my expected results, but the problem is when I try to
do any operation on the entity I get an error
Caused by: java.lang.ClassCastException: [Ljava.lang.Object; incompatible
with com.domain.Country
In this test I am just trying to get the names from the country
for (Country country : countryList) {
country.getName();
}
Casting the result does not work either.
Shouldn’t the returned objects be of the Entity type?
What am I doing wrong? How do I get the Entity type result?
Thanks.
--
View this message in context:
http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at
Nabble.com.