openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Siegel" <marc.siegel...@gmail.com>
Subject Re: Programmatically pagination does NOT work with OpenJPA 1.0.1
Date Tue, 01 Jan 2008 00:54:45 GMT
Hi Patrick,

Well, there is some serious pre-New Years egg on my face.
Please disregard previous email.

For future reference, the results pattern described in the previous
email correspond to a
setFirstResult / setMaxResults mis-usage where the query that is being
executed each time does not return the results from the previous
batch, as the processing they underwent after the query makes them
(intentionally) fail to qualify for the next iteration of the query.

Thanks anyway,
-Marc

On Dec 31, 2007 7:16 PM, Marc Siegel <marc.siegel.17@gmail.com> wrote:
> Hi Patrick,
>
> I am seeing a problem where setFirstResult / setMaxResults does not
> perform as expected.
> Using a contant batch size of 1000 for setMaxResults, I try to iterate
> over batches of objects.
>
> When there are 1500 such objects, the first query returns the first
> 1000. The second query, with
> setFirstResult(1000) and setMaxResults(1000) returns 0 results.
>
> When there are 5100 such objects, something much more strange happens.
> The first query returns 1000 results, as do the second and third
> queries. The fourth query (i.e. the one with setFirstResult(3000))
> returns 0 results. But looking deeper at the results, I see that the
> queries returned the following data:
>   setFirstResult(0), setMaxResults(1000)       =>  rows 1-1000
>   setFirstResult(1000), setMaxResults(1000)  =>  rows 2001-3000
>   setFirstResult(1000), setMaxResults(1000)  =>  rows 4001-5000
>
> Does this sort of behavior ring any bells?
> Is this a DBDictionary subclass issue that I can address for sqlite?
>
> My stack:
> - openjpa 1.0.1 (same behavior on 1.1.0-SNAPSHOT)
> - sqlitejdbc 0.37
> - sqlite 3.1.3
> - java 1.5
> - build-time enhancement
>
> Thanks,
> -Marc
>
>
> On Dec 6, 2007 1:43 AM, Patrick Linskey <plinskey@gmail.com> wrote:
> > FTR, I think that this is now resolved in the 1.1.0 snapshots.
> >
> > -Patrick
> >
> >
> > On Dec 6, 2007 1:08 PM, roger.keays <roger.keays@ninthavenue.com.au> wrote:
> > >
> > > same problem on postgres 7.4. broken in 1.0.1 but works in 1.0.0
> > >
> > > will there be a 1.0.2 release to fix these sorts of things?
> > >
> > > cheers,
> > >
> > > rog
> > >
> > >
> > > Marc Prud'hommeaux wrote:
> > > >
> > > > Frank-
> > > >
> > > > This sounds like something that was fixed in the trunk for revision
> > > > #584463:
> > > >
> > > >   <http://svn.apache.org/viewvc?view=rev&revision=584463>
> > > >
> > > > It was a fix for a problem introduced by
> > > > <https://issues.apache.org/jira/browse/OPENJPA-378
> > > >  >.
> > > >
> > > > The latest trunk snapshots don't have the bug, but the fix would need
> > > > to be backported to 1.0 branch if a fix is needed for that line.
> > > >
> > > > Can you open a JIRA so we can track it?
> > > >
> > > >
> > > >
> > > > On Nov 12, 2007, at 5:11 PM, frankca wrote:
> > > >
> > > >>
> > > >> I run a regression tests from 1.0.0 i.e. the tests work with 1.0.0.
> > > >>
> > > >> Look at the generated SQLs, it obviously missing the subquery using
> > > >> ROWNUM
> > > >> (using Oracle DB).
> > > >>
> > > >> Here are the SQL stmts:
> > > >> OpenJPA 1.0.1:
> > > >>
> > > >> SELECT t0.id AS c0, t0.version AS c1, t0.last_updated_by AS c2,
> > > >> t0.last_updated_date AS c3, t1.id AS c4, t1.version AS c5,
> > > >> t1.last_updated_by AS c6, t1.last_updated_date AS c7, t2.id AS c8,
> > > >> t2.version AS c9, t2.last_updated_by AS c10, t2.last_updated_date
AS
> > > >> c11,
> > > >> t2.language AS c12, t2.name AS c13, t1.content AS c14, t3.id AS c15,
> > > >> t3.version AS c16, t3.last_updated_by AS c17, t3.last_updated_date
> > > >> AS c18,
> > > >> t3.name AS c19, t1.load_date AS c20, t4.id AS c21, t4.type AS c22,
> > > >> t1.modified AS c23, t1.review_status AS c24, t1.title AS c25, t1.url
> > > >> AS c26,
> > > >> t5.id AS c27, t5.version AS c28, t5.last_updated_by AS c29,
> > > >> t5.last_updated_date AS c30, t5.name AS c31, t6.id AS c32,
> > > >> t6.version AS
> > > >> c33, t6.last_updated_by AS c34, t6.last_updated_date AS c35, t6.name
> > > >> AS c36,
> > > >> t7.id AS c37, t7.version AS c38, t7.last_updated_by AS c39,
> > > >> t7.last_updated_date AS c40, t7.name AS c41, t0.byte_length AS c42,
> > > >> t0.byte_offset AS c43, t0.text AS c44 FROM fact t0, document t1,
> > > >> collection
> > > >> t2, data_source t3, mime_type t4, fact_rule t5, fact_type t6,
> > > >> fact_type t7
> > > >> WHERE (t0.fact_type_fk = ? AND t0.document_fk = ?) AND
> > > >> t0.document_fk =
> > > >> t1.id(+) AND t0.fact_rule_fk = t5.id(+) AND t0.fact_type_fk =
> > > >> t7.id(+) AND
> > > >> t1.collection_fk = t2.id(+) AND t1.data_source_fk = t3.id(+) AND
> > > >> t1.mime_type_fk = t4.id(+) AND t5.fact_type_fk = t6.id(+)
> > > >> [params=(long) 3,
> > > >> (long) 2]
> > > >>
> > > >> OpenJPA 1.0.0:
> > > >>
> > > >> SELECT * FROM (SELECT r.*, ROWNUM RNUM FROM (SELECT t0.id AS c0,
> > > >> t0.version
> > > >> AS c1, t0.last_updated_by AS c2, t0.last_updated_date AS c3, t1.id
> > > >> AS c4,
> > > >> t1.version AS c5, t1.last_updated_by AS c6, t1.last_updated_date AS
> > > >> c7,
> > > >> t2.id AS c8, t2.version AS c9, t2.last_updated_by AS c10,
> > > >> t2.last_updated_date AS c11, t2.language AS c12, t2.name AS c13,
> > > >> t1.content
> > > >> AS c14, t3.id AS c15, t3.version AS c16, t3.last_updated_by AS c17,
> > > >> t3.last_updated_date AS c18, t3.name AS c19, t1.load_date AS c20,
> > > >> t4.id AS
> > > >> c21, t4.type AS c22, t1.modified AS c23, t1.review_status AS c24,
> > > >> t1.title
> > > >> AS c25, t1.url AS c26, t5.id AS c27, t5.version AS c28,
> > > >> t5.last_updated_by
> > > >> AS c29, t5.last_updated_date AS c30, t5.name AS c31, t6.id AS c32,
> > > >> t6.version AS c33, t6.last_updated_by AS c34, t6.last_updated_date
> > > >> AS c35,
> > > >> t6.name AS c36, t7.id AS c37, t7.version AS c38, t7.last_updated_by
> > > >> AS c39,
> > > >> t7.last_updated_date AS c40, t7.name AS c41, t0.byte_length AS c42,
> > > >> t0.byte_offset AS c43, t0.text AS c44 FROM fact t0, document t1,
> > > >> collection
> > > >> t2, data_source t3, mime_type t4, fact_rule t5, fact_type t6,
> > > >> fact_type t7
> > > >> WHERE (t0.fact_type_fk = ? AND t0.document_fk = ?) AND
> > > >> t0.document_fk =
> > > >> t1.id(+) AND t0.fact_rule_fk = t5.id(+) AND t0.fact_type_fk =
> > > >> t7.id(+) AND
> > > >> t1.collection_fk = t2.id(+) AND t1.data_source_fk = t3.id(+) AND
> > > >> t1.mime_type_fk = t4.id(+) AND t5.fact_type_fk = t6.id(+)) r WHERE
> > > >> ROWNUM <=
> > > >> ?) WHERE RNUM > ? [params=(long) 3, (long) 2, (long) 5, (long)
2]
> > > >>
> > > >> -Frank
> > > >>
> > > >>
> > > >>
> > > >> Patrick Linskey-2 wrote:
> > > >>>
> > > >>> What SQL do you see? Is this a regression from 1.0.0, or something
> > > >>> that you're running into for the first time?
> > > >>>
> > > >>> -Patrick
> > > >>>
> > > >>> On Nov 12, 2007 4:46 PM, frankca <frankca@gmail.com> wrote:
> > > >>>>
> > > >>>> Programmatically pagination does NOT work with OpenJPA 1.0.1
i.e.
> > > >>>> using
> > > >>>> EntityManager.setFirstResult()/setMaxResults().
> > > >>>>
> > > >>>> Sorry, I don't have time to package a test case for now.
> > > >>>>
> > > >>>> -Frank
> > > >>>>
> > > >>>> --
> > > >>>> View this message in context:
> > > >>>> http://www.nabble.com/Programmatically-pagination-does-NOT-work-with-OpenJPA-1.0.1-tf4795034.html#a13717713
> > > >>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > > >>>>
> > > >>>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> --
> > > >>> Patrick Linskey
> > > >>> 202 669 5907
> > > >>>
> > > >>>
> > > >>
> > > >> --
> > > >> View this message in context:
> > > >> http://www.nabble.com/Programmatically-pagination-does-NOT-work-with-OpenJPA-1.0.1-tf4795034.html#a13717920
> > > >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > > >>
> > > >
> > > >
> > > >
> > >
> > > --
> > > View this message in context: http://www.nabble.com/Programmatically-pagination-does-NOT-work-with-OpenJPA-1.0.1-tf4795034.html#a14186916
> > >
> > > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > >
> > >
> >
> >
> >
> > --
> > Patrick Linskey
> > 202 669 5907
> >
>

Mime
View raw message