cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Stobbe <markstobb...@gmail.com>
Subject Re: Disjoint by id
Date Tue, 15 Nov 2016 08:06:49 GMT
I also noticed that it adds t0.id = NULL conditions. However, id is a
primary key so it doesn't really make sense to check for NULL.
Example query:

SELECT t0.*
FROM   djem_account t0
WHERE  ( t0.id IS NULL )
        OR ( t0.id = 208 )
        OR ( t0.id = 208 )
        OR ( t0.id = 208 )
        OR ( t0.id = 208 )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id = 208 )
        OR ( t0.id = 208 )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id = 208 )
        OR ( t0.id = 208 )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL )
        OR ( t0.id IS NULL );

On Tue, Nov 15, 2016 at 7:43 AM, Andrus Adamchik <andrus@objectstyle.org>
wrote:

> Could be a bug. I just opened a Jira [1] to investigate. From what I am
> seeing the current behavior is correct in respect to the returned result,
> but is certainly suboptimal.
>
> Andrus
>
> [1] https://issues.apache.org/jira/browse/CAY-2141
>
> > On Nov 14, 2016, at 11:25 PM, Mark Stobbe <markstobbe85@gmail.com>
> wrote:
> >
> > Hi Andrus,
> >
> > Version 3.2M1. Relationship would be a normal to-one yes. I am executing
> a
> > query for the first 25 records of "djem_user".
> > Configuration is the following:
> >
> > <db-entity name="djem_account">
> >  <db-attribute name="id" type="BIGINT" isMandatory="true"
> > isPrimaryKey="true" />
> > </db-entity>
> >
> > <db-entity name="djem_user">
> >  <db-attribute name="id" type="BIGINT" isMandatory="true"
> > isPrimaryKey="true" />
> >  <db-attribute name="fk_acco" type="BIGINT" />
> > </db-entity>
> >
> > <db-relationship name="user_acco" source="djem_user"
> target="djem_account"
> > toMany="false">
> >  <db-attribute-pair source="fk_acco" target="id" />
> > </db-relationship>
> >
> > <db-relationship name="acco_user" source="djem_account"
> target="djem_user"
> > toMany="true">
> >  <db-attribute-pair source="id" target="fk_acco" />
> > </db-relationship>
> >
> > Mark
> >
> > On Mon, Nov 14, 2016 at 6:17 PM, Andrus Adamchik <andrus@objectstyle.org
> >
> > wrote:
> >
> >> Hi Mark,
> >>
> >> Yeah, doesn't look right. What version of Cayenne is this? And what is
> the
> >> relationship semantics? Is this a regular to-one?
> >>
> >> Andrus
> >>
> >>> On Nov 14, 2016, at 6:02 PM, Mark Stobbe <markstobbe85@gmail.com>
> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I was wondering if this is correct:
> >>>
> >>> I am using an fetch limit for some queries, though I also need to make
> >> sure
> >>> I add the prefetch rules to refresh the data. I read in the
> documentation
> >>> that i should use DISJOINT_BY_ID_PREFETCH_SEMANTICS, so I did. Now
> when
> >> I
> >>> look at the queries I am a little bit surprised because I see the same
> id
> >>> occur many times. Shouldn't this be purged before building the query?
> >>>
> >>> Example query would be:
> >>>
> >>> SELECT t0.*
> >>> FROM   djem_account t0
> >>> WHERE  ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 217 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 )
> >>>       OR ( t0.id = 219 );
> >>>
> >>> Best regards,
> >>> Mark Stobbe
> >>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message