You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by akm <am...@ford.com> on 2015/08/06 21:52:20 UTC

Return type of Repository native query

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.

Re: Return type of Repository native query

Posted by akm <am...@ford.com>.
Issue created.
https://issues.apache.org/jira/browse/DELTASPIKE-978





--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661343.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: Return type of Repository native query

Posted by Gerhard Petracek <ge...@gmail.com>.
hi akm,

everybody can access it after creating an account (see [1]).

regards,
gerhard

[1] http://s.apache.org/Gnz



2015-08-07 18:40 GMT+02:00 akm <am...@ford.com>:

> I don't seem to have access to open an issue
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661340.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>

Re: Return type of Repository native query

Posted by akm <am...@ford.com>.
I don't seem to have access to open an issue



--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661340.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: Return type of Repository native query

Posted by Daniel Cunha <da...@gmail.com>.
Hi Akm,

please, can you open an issue for it?
https://issues.apache.org/jira/browse/DELTASPIKE

Thank you.

On Fri, Aug 7, 2015 at 1:19 PM, Daniel Cunha <da...@gmail.com> wrote:

> Thomas,
>
> if you don't have time to see it,  I can doing on next week.
> Let me know if you have time to fix it
>
> On Fri, Aug 7, 2015 at 1:07 PM, akm <am...@ford.com> wrote:
>
>> Thanks Thomas for the response.
>>
>> It works with the workaround.
>>
>> Any idea if the bug will be fixed?
>> Thanks
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661337.html
>> Sent from the Apache DeltaSpike Incubator Discussions mailing list
>> archive at Nabble.com.
>>
>
>
>
> --
> Best regard,
> Daniel Cunha (soro)
>



-- 
Best regard,
Daniel Cunha (soro)

Re: Return type of Repository native query

Posted by Daniel Cunha <da...@gmail.com>.
Thomas,

if you don't have time to see it,  I can doing on next week.
Let me know if you have time to fix it

On Fri, Aug 7, 2015 at 1:07 PM, akm <am...@ford.com> wrote:

> Thanks Thomas for the response.
>
> It works with the workaround.
>
> Any idea if the bug will be fixed?
> Thanks
>
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661337.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>



-- 
Best regard,
Daniel Cunha (soro)

Re: Return type of Repository native query

Posted by Daniel Cunha <da...@gmail.com>.
Very nice!!! :D

On Fri, Aug 7, 2015 at 5:45 PM, Thomas Hug <th...@gmail.com> wrote:

> Hi Daniel
> Thnx yes I can take this one. It's about time I show up in Git history
> again :-)
>
> On Fri, Aug 7, 2015 at 6:19 PM, Daniel Cunha <da...@gmail.com> wrote:
>
> > Thomas,
> >
> > if you don't have time to see it,  I can doing on next week.
> > Let me know if you have time to fix it
> >
> > On Fri, Aug 7, 2015 at 1:07 PM, akm <am...@ford.com> wrote:
> >
> > > Thanks Thomas for the response.
> > >
> > > It works with the workaround.
> > >
> > > Any idea if the bug will be fixed?
> > > Thanks
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661337.html
> > > Sent from the Apache DeltaSpike Incubator Discussions mailing list
> > archive
> > > at Nabble.com.
> > >
> >
> >
> >
> > --
> > Best regard,
> > Daniel Cunha (soro)
> >
>



-- 
Best regard,
Daniel Cunha (soro)

Re: Return type of Repository native query

Posted by Thomas Hug <th...@gmail.com>.
Pushing this one as soon as the release is out.

On Fri, Aug 7, 2015 at 11:22 PM, Daniel Cunha <da...@gmail.com> wrote:

> Very nice!!! :D
>
> On Fri, Aug 7, 2015 at 5:45 PM, Thomas Hug <th...@gmail.com> wrote:
>
> > Hi Daniel
> > Thnx yes I can take this one. It's about time I show up in Git history
> > again :-)
> >
> > On Fri, Aug 7, 2015 at 6:19 PM, Daniel Cunha <da...@gmail.com>
> wrote:
> >
> > > Thomas,
> > >
> > > if you don't have time to see it,  I can doing on next week.
> > > Let me know if you have time to fix it
> > >
> > > On Fri, Aug 7, 2015 at 1:07 PM, akm <am...@ford.com> wrote:
> > >
> > > > Thanks Thomas for the response.
> > > >
> > > > It works with the workaround.
> > > >
> > > > Any idea if the bug will be fixed?
> > > > Thanks
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661337.html
> > > > Sent from the Apache DeltaSpike Incubator Discussions mailing list
> > > archive
> > > > at Nabble.com.
> > > >
> > >
> > >
> > >
> > > --
> > > Best regard,
> > > Daniel Cunha (soro)
> > >
> >
>
>
>
> --
> Best regard,
> Daniel Cunha (soro)
>

Re: Return type of Repository native query

Posted by Thomas Hug <th...@gmail.com>.
Hi Daniel
Thnx yes I can take this one. It's about time I show up in Git history
again :-)

On Fri, Aug 7, 2015 at 6:19 PM, Daniel Cunha <da...@gmail.com> wrote:

> Thomas,
>
> if you don't have time to see it,  I can doing on next week.
> Let me know if you have time to fix it
>
> On Fri, Aug 7, 2015 at 1:07 PM, akm <am...@ford.com> wrote:
>
> > Thanks Thomas for the response.
> >
> > It works with the workaround.
> >
> > Any idea if the bug will be fixed?
> > Thanks
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661337.html
> > Sent from the Apache DeltaSpike Incubator Discussions mailing list
> archive
> > at Nabble.com.
> >
>
>
>
> --
> Best regard,
> Daniel Cunha (soro)
>

Re: Return type of Repository native query

Posted by akm <am...@ford.com>.
Thanks Thomas for the response.

It works with the workaround.

Any idea if the bug will be fixed?
Thanks




--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Return-type-of-Repository-native-query-tp4661333p4661337.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.