[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Lazy loading performance problem (Warren Tang)
|
Batch fetching works with pagination as long as you use IN batch fetching.
Reinhard Girstenbrei wrote:
>
> Hi Warren,
> It looks like you want to use the EclipseLink feature called "batch
> reading".
> http://wiki.eclipse.org/Optimizing_the_EclipseLink_Application_%28ELUG%29#How_to_Use_Batch_and_Join_Reading_for_Optimization
>
> At the same time you want to use the EclipseLink "pagination" feature.
> http://wiki.eclipse.org/EclipseLink/Examples/JPA/Pagination
>
> Both are not supported to be used together at the moment.
>
> To support this EclipseLink would have to create SQL queries with sub
> queries which many database servers do not support.
> Anyway I have filed a request for such feature in the Oracle bug database
> for the product TopLink.
> Bug 10108121 - IMPROVE PAGINATION FOR BATCH READING QUERIES
> If you have access to "My Oracle Support" then you will be able to read
> the details.
> You can file an enhancement request in the Eclipse bug database if you
> like.
>
> Best regards,
> Reinhard
>
> -----Original Message-----
> From: eclipselink-users-request@xxxxxxxxxxx
> [mailto:eclipselink-users-request@xxxxxxxxxxx]
> Sent: Freitag, 4. November 2011 13:50
> To: eclipselink-users@xxxxxxxxxxx
> Subject: eclipselink-users Digest, Vol 51, Issue 24
>
> Send eclipselink-users mailing list submissions to
> eclipselink-users@xxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> or, via email, send a message with subject or body 'help' to
> eclipselink-users-request@xxxxxxxxxxx
>
> You can reach the person managing the list at
> eclipselink-users-owner@xxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of eclipselink-users digest..."
>
>
> Today's Topics:
>
> 1. Lazy loading performance problem (Warren Tang)
> 2. L2 Cache Question (Leon Derks)
> 3. Re: Lazy loading performance problem (Leon Derks)
> 4. Re: Bug 362564 - WebSphere specific
> randomisedorg.eclipse.persistence.exceptions.JPQLException error
> on startup (Nathan Drew)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 04 Nov 2011 17:36:42 +0800
> From: Warren Tang <warren.c.tang@xxxxxxxxx>
> To: EclipseLink <eclipselink-users@xxxxxxxxxxx>
> Subject: [eclipselink-users] Lazy loading performance problem
> Message-ID: <4EB3B22A.4080405@xxxxxxxxx>
> Content-Type: text/plain; charset="gb2312"
>
> Hi, everybody
>
> I have an ExamPaper entity which has many ChoiceQuestions. The questions
> are lazy loaded by default (fetch=LAZY).
>
> Now I want to get all the quesitions that belong to a specific
> ExamPaper, so I use the following JPQL:
>
> "select p.questions from ExamPaper p where p.id=:paperId";
>
> The problem is that questions are "lazy" loaded, so there is one
> "SELECT" executed for *every single* question. But I want to select them
> all in one go for performance reasons. What should I do?
>
> ------------------ Code listing -----------------------------------
>
> @Entity
> public class ExamPaper {
> public static final String SELECT_QUESTION_BY_PAPER = "select
> p.questions from ExamPaper p where p.id=:paperId";
>
> @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
> private Long id;
> private String name;
> @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true, cascade =
> {CascadeType.ALL})
> List<ChoiceQuestion> questions;
>
> ... ...
> }
>
> query = em.createQuery(ExamPaper.SELECT_QUESTION_BY_PAPER,
> ChoiceQuestion.class);
> query.setParameter("paperId", examPaperId);
> query.setFirstResult(startPosition);
> query.setMaxResults(maxResult);
> list = query.getResultList();
>
> --
> Regards,
> Warren Tang <http://blog.tangcs.com>
>
>
>
-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
Blog: http://java-persistence-performance.blogspot.com/ Java Persistence
Performance
--
View this message in context: http://old.nabble.com/Re%3A-Lazy-loading-performance-problem-%28Warren-Tang%29-tp32780312p32811782.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.