You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Johannes <jo...@gmail.com> on 2014/12/03 00:25:22 UTC

Unexpected null value when prefetching with Cayenne.objectForQuery

Hello

I had a problem when query for a entity with Cayenne.objectForQuery in
the particulare case of receiving null values by addPrefetch on
Many-to-many fields.

Also postet here:

https://issues.apache.org/jira/browse/CAY-1975

Johannes


Re: Unexpected null value when prefetching with Cayenne.objectForQuery

Posted by Johannes <jo...@gmail.com>.
I completed on Jira. Regards Johannes

Am 03.12.2014 um 07:55 schrieb Andrus Adamchik:
> Hi Johannes,
> 
> As Ari mentioned in the Jira comment, could you please post some details, like the query code. Also SQL output generated by Cayenne for the queries in question.
> 
> Thanks,
> Andrus
> 
>> On Dec 3, 2014, at 2:25 AM, Johannes <jo...@gmail.com> wrote:
>>
>> Hello
>>
>> I had a problem when query for a entity with Cayenne.objectForQuery in
>> the particulare case of receiving null values by addPrefetch on
>> Many-to-many fields.
>>
>> Also postet here:
>>
>> https://issues.apache.org/jira/browse/CAY-1975
>>
>> Johannes
>>
> 


Re: Unexpected null value when prefetching with Cayenne.objectForQuery

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Johannes,

As Ari mentioned in the Jira comment, could you please post some details, like the query code. Also SQL output generated by Cayenne for the queries in question.

Thanks,
Andrus

> On Dec 3, 2014, at 2:25 AM, Johannes <jo...@gmail.com> wrote:
> 
> Hello
> 
> I had a problem when query for a entity with Cayenne.objectForQuery in
> the particulare case of receiving null values by addPrefetch on
> Many-to-many fields.
> 
> Also postet here:
> 
> https://issues.apache.org/jira/browse/CAY-1975
> 
> Johannes
> 


Re: Unexpected null value when prefetching with Cayenne.objectForQuery

Posted by Johannes <jo...@gmail.com>.
No, I didn't read this, only the 3.1 documentation.
Of course my example is very simple. In that case, your are right,
SelectQuery is a better choice.
I found this issue, while doing a select-mix between persistent object
and some aggregate values, and I wanted to eleminate the lazy loading.

Thanks for your link! Johannes

Am 03.12.2014 um 23:23 schrieb Aristedes Maniatis:
> Did you see the documentation here: https://cayenne.apache.org/docs/3.0/advanced-sqltemplate.html
> 
> At any rate, I suggest that you don't use SQLTemplate unless you really need to. Instead, use a regular SelectQuery where you don't need to craft complex SQL. This will keep your code independent of database specifics.
> 
> Ari
> 
> 
> On 3/12/2014 10:25am, Johannes wrote:
>> Hello
>>
>> I had a problem when query for a entity with Cayenne.objectForQuery in
>> the particulare case of receiving null values by addPrefetch on
>> Many-to-many fields.
>>
>> Also postet here:
>>
>> https://issues.apache.org/jira/browse/CAY-1975
>>
>> Johannes
>>
> 


Re: Unexpected null value when prefetching with Cayenne.objectForQuery

Posted by Aristedes Maniatis <ar...@maniatis.org>.
Did you see the documentation here: https://cayenne.apache.org/docs/3.0/advanced-sqltemplate.html

At any rate, I suggest that you don't use SQLTemplate unless you really need to. Instead, use a regular SelectQuery where you don't need to craft complex SQL. This will keep your code independent of database specifics.

Ari


On 3/12/2014 10:25am, Johannes wrote:
> Hello
> 
> I had a problem when query for a entity with Cayenne.objectForQuery in
> the particulare case of receiving null values by addPrefetch on
> Many-to-many fields.
> 
> Also postet here:
> 
> https://issues.apache.org/jira/browse/CAY-1975
> 
> Johannes
> 

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A