Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » LIMIT query not framed correctly when using CompositePU
LIMIT query not framed correctly when using CompositePU [message #1732467] Tue, 17 May 2016 13:57
G M is currently offline G MFriend
Messages: 3
Registered: July 2014
Junior Member
(The database used is MySQL in our case, not sure if the problem is reproducible with other DBs)

MySQL has a LIMIT query of the form:
SELECT ___...___ LIMIT <start>, <row_count>


In eclipselink the query is formed as below:
			String queryStr = "SELECT t FROM " + TableOne.class.getName() + " t ";
			Query query = em.createQuery(queryStr);
			query.setFirstResult(start);
			query.setMaxResults(range);
			result = query.getResultList();



When CompositePU is used consisting of one or more child persistence units, the LIMIT query is not framed correctly.

For start = 3 and range = 3:
Expected:
SELECT ___...___ LIMIT 3, 3

Query formed:
SELECT ___...___ LIMIT 3, 6


For start = 3 and range = 1:
Expected:
SELECT ___...___ LIMIT 3, 1

Query formed:
SELECT ___...___ LIMIT 3, 4


Eclipselink sets the row_count as
query.setFirstResult() + query.setMaxResults()
instead of
query.setMaxResults()


This issue occurs only when CompositePU is used.

Question: Could this be a bug or something we are doing wrong?
Previous Topic:The question about using fetchgraph
Next Topic:Multitenancy and History Policy not working together
Goto Forum:
  


Current Time: Sat Mar 28 17:25:32 GMT 2020

Powered by FUDForum. Page generated in 0.05940 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top