This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository topia. See https://gitlab.nuiton.org/nuiton/topia.git commit 056ac659c94c6e48da297ac49beb16f73b18f05d Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun May 1 17:05:09 2016 +0200 Ajout d'un nouvel état pour savoir si a des clauses order by, cela permet d'effectuer l'anomalie sur findAllLazy (See #3950) --- .../persistence/internal/AbstractTopiaDao.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java b/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java index a39c023..6a6b503 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java @@ -408,7 +408,9 @@ public abstract class AbstractTopiaDao<E extends TopiaEntity> implements TopiaDa } protected InnerTopiaQueryBuilderRunQueryStep<E> forHql(String hql, Map<String, Object> hqlParameters) { - InnerTopiaQueryBuilderRunQueryStep<E> result = new InnerTopiaQueryBuilderRunQueryStep<E>(this, true, hql, hqlParameters); + //FIXME tchemit-2016-05-01 Should we scan in hql code if there is an orderBy ? + boolean withOrderByClause = false; + InnerTopiaQueryBuilderRunQueryStep<E> result = new InnerTopiaQueryBuilderRunQueryStep<E>(this, true, withOrderByClause, hql, hqlParameters); return result; } @@ -1081,13 +1083,15 @@ public abstract class AbstractTopiaDao<E extends TopiaEntity> implements TopiaDa protected InnerTopiaQueryBuilderRunQueryStep<E> getNextStep() { String hql = hqlAndParametersBuilder.getHql(); Map<String, Object> hqlParameters = hqlAndParametersBuilder.getHqlParameters(); + boolean withOrderByClause = hqlAndParametersBuilder.isOrderByClausePresent(); InnerTopiaQueryBuilderRunQueryStep<E> nextStep; if (hqlAndParametersBuilder.hasFetchProperties()) { String hqlForFetchStep1 = hqlAndParametersBuilder.getHqlForFetchStep1(); String hqlForFetchStep2 = hqlAndParametersBuilder.getHqlForFetchStep2(); - nextStep = new InnerTopiaQueryBuilderRunQueryStep<E>(topiaDao, false, hql, hqlParameters, hqlForFetchStep1, hqlForFetchStep2); + nextStep = new InnerTopiaQueryBuilderRunQueryStep<E>(topiaDao, false, withOrderByClause, hql, hqlParameters, hqlForFetchStep1, hqlForFetchStep2); } else { - nextStep = new InnerTopiaQueryBuilderRunQueryStep<E>(topiaDao, false, hql, hqlParameters); + + nextStep = new InnerTopiaQueryBuilderRunQueryStep<E>(topiaDao, false, withOrderByClause, hql, hqlParameters); } return nextStep; } @@ -1104,24 +1108,29 @@ public abstract class AbstractTopiaDao<E extends TopiaEntity> implements TopiaDa protected final boolean fromHql; + protected final boolean withOrderByClause; + protected final String hqlForFetchStep1; protected final String hqlForFetchStep2; protected InnerTopiaQueryBuilderRunQueryStep(AbstractTopiaDao<E> topiaDao, boolean fromHql, + boolean withOrderByClause, String hql, Map<String, Object> hqlParameters) { - this(topiaDao, fromHql, hql, hqlParameters, null, null); + this(topiaDao, fromHql, withOrderByClause, hql, hqlParameters, null, null); } protected InnerTopiaQueryBuilderRunQueryStep(AbstractTopiaDao<E> topiaDao, boolean fromHql, + boolean withOrderByClause, String hql, Map<String, Object> hqlParameters, String hqlForFetchStep1, String hqlForFetchStep2) { this.fromHql = fromHql; + this.withOrderByClause = withOrderByClause; this.hql = hql; this.hqlParameters = hqlParameters; this.topiaDao = topiaDao; @@ -1192,12 +1201,12 @@ public abstract class AbstractTopiaDao<E extends TopiaEntity> implements TopiaDa @Override public Iterable<E> findAllLazy() { - return topiaDao.findAllLazy(hql + (fromHql ? "" : " ORDER BY id "), hqlParameters); + return topiaDao.findAllLazy(hql + (fromHql || withOrderByClause ? "" : " ORDER BY id "), hqlParameters); } @Override public Iterable<E> findAllLazy(int batchSize) { - return topiaDao.findAllLazy(hql + (fromHql ? "" : " ORDER BY id "), hqlParameters, batchSize); + return topiaDao.findAllLazy(hql + (fromHql || withOrderByClause ? "" : " ORDER BY id "), hqlParameters, batchSize); } @Override -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.