You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Lon Varscsak <lo...@gmail.com> on 2018/07/31 01:02:46 UTC
Blobs and distinct
Hey all,
I have an entity with a blob in it, but it has has to-many joins. When I
go to do a join across these, I will no longer get a distinct set of data
(because at least in Sybase, you can't 'distinct' a blob column).
Any ideas on how to implement this so that the blob is lazy and/or in a
different entity (without it actually being in a different table)?
-Lon
Re: Blobs and distinct
Posted by Nikita Timofeev <nt...@objectstyle.com>.
Just now I'm prototyping subqueries API :)
Here is how two levels deep subquery can look like [1].
Though it all will be available not earlier than in Cayenne 4.2
[1] https://github.com/stariy95/cayenne/blob/6beb455b1c1b91200e1bb688168ae51d2e4a8f24/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_SubqueryIT.java#L125
On Tue, Jul 31, 2018 at 1:52 PM, Maik Musall <ma...@selbstdenker.ag> wrote:
> Here's what we use for EXISTS queries with Cayenne:
>
> https://gist.github.com/maiksd/bd32e75968cbf0c76fb05a3c7d244e7c
>
> Maik
>
> P.S. most of this is by Hugi
>
>
>> Am 31.07.2018 um 10:55 schrieb Andrus Adamchik <an...@objectstyle.org>:
>>
>> I guess Cayenne needs an ability to use EXISTS query or something for to-many conditions instead of a straight join with DISTINCT.
>>
>> Until then you'd probably have to do some in-memory condition checking, or running the query from the other side of the relationship.
>>
>> Andrus
>>
>>
>>> On Jul 31, 2018, at 4:02 AM, Lon Varscsak <lo...@gmail.com> wrote:
>>>
>>> Hey all,
>>>
>>> I have an entity with a blob in it, but it has has to-many joins. When I
>>> go to do a join across these, I will no longer get a distinct set of data
>>> (because at least in Sybase, you can't 'distinct' a blob column).
>>>
>>> Any ideas on how to implement this so that the blob is lazy and/or in a
>>> different entity (without it actually being in a different table)?
>>>
>>> -Lon
>>
>
--
Best regards,
Nikita Timofeev
Re: Blobs and distinct
Posted by Maik Musall <ma...@selbstdenker.ag>.
Here's what we use for EXISTS queries with Cayenne:
https://gist.github.com/maiksd/bd32e75968cbf0c76fb05a3c7d244e7c
Maik
P.S. most of this is by Hugi
> Am 31.07.2018 um 10:55 schrieb Andrus Adamchik <an...@objectstyle.org>:
>
> I guess Cayenne needs an ability to use EXISTS query or something for to-many conditions instead of a straight join with DISTINCT.
>
> Until then you'd probably have to do some in-memory condition checking, or running the query from the other side of the relationship.
>
> Andrus
>
>
>> On Jul 31, 2018, at 4:02 AM, Lon Varscsak <lo...@gmail.com> wrote:
>>
>> Hey all,
>>
>> I have an entity with a blob in it, but it has has to-many joins. When I
>> go to do a join across these, I will no longer get a distinct set of data
>> (because at least in Sybase, you can't 'distinct' a blob column).
>>
>> Any ideas on how to implement this so that the blob is lazy and/or in a
>> different entity (without it actually being in a different table)?
>>
>> -Lon
>
Re: Blobs and distinct
Posted by Andrus Adamchik <an...@objectstyle.org>.
I guess Cayenne needs an ability to use EXISTS query or something for to-many conditions instead of a straight join with DISTINCT.
Until then you'd probably have to do some in-memory condition checking, or running the query from the other side of the relationship.
Andrus
> On Jul 31, 2018, at 4:02 AM, Lon Varscsak <lo...@gmail.com> wrote:
>
> Hey all,
>
> I have an entity with a blob in it, but it has has to-many joins. When I
> go to do a join across these, I will no longer get a distinct set of data
> (because at least in Sybase, you can't 'distinct' a blob column).
>
> Any ideas on how to implement this so that the blob is lazy and/or in a
> different entity (without it actually being in a different table)?
>
> -Lon