r2976 - trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal
Author: tchemit Date: 2014-01-13 19:36:11 +0100 (Mon, 13 Jan 2014) New Revision: 2976 Url: http://nuiton.org/projects/topia/repository/revisions/2976 Log: refs #3001: findAllLazy() after a forXxxEquals(...) fails (should be ok, but more tests must be done Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java 2014-01-13 14:00:23 UTC (rev 2975) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java 2014-01-13 18:36:11 UTC (rev 2976) @@ -364,7 +364,7 @@ } protected InnerTopiaQueryBuilderRunQueryStep<E> forHql(String hql, Map<String, Object> hqlParameters) { - InnerTopiaQueryBuilderRunQueryStep<E> result = new InnerTopiaQueryBuilderRunQueryStep<E>(this, hql, hqlParameters); + InnerTopiaQueryBuilderRunQueryStep<E> result = new InnerTopiaQueryBuilderRunQueryStep<E>(this, true, hql, hqlParameters); return result; } @@ -912,7 +912,7 @@ protected InnerTopiaQueryBuilderRunQueryStep<E> getNextStep() { String hql = hqlAndParametersBuilder.getHql(); Map<String, Object> hqlParameters = hqlAndParametersBuilder.getHqlParameters(); - InnerTopiaQueryBuilderRunQueryStep<E> nextStep = new InnerTopiaQueryBuilderRunQueryStep<E>(topiaDAO, hql, hqlParameters); + InnerTopiaQueryBuilderRunQueryStep<E> nextStep = new InnerTopiaQueryBuilderRunQueryStep<E>(topiaDAO, false, hql, hqlParameters); return nextStep; } @@ -926,7 +926,13 @@ protected final AbstractTopiaDao<E> topiaDAO; - protected InnerTopiaQueryBuilderRunQueryStep(AbstractTopiaDao<E> topiaDAO, String hql, Map<String, Object> hqlParameters) { + protected final boolean fromHql; + + protected InnerTopiaQueryBuilderRunQueryStep(AbstractTopiaDao<E> topiaDAO, + boolean fromHql, + String hql, + Map<String, Object> hqlParameters) { + this.fromHql = fromHql; this.hql = hql; this.hqlParameters = hqlParameters; this.topiaDAO = topiaDAO; @@ -995,12 +1001,12 @@ @Override public Iterable<E> findAllLazy() { - return topiaDAO.findAllLazy(hql, hqlParameters); + return topiaDAO.findAllLazy(hql +(fromHql?"":" ORDER BY id") , hqlParameters); } @Override public Iterable<E> findAllLazy(int batchSize) { - return topiaDAO.findAllLazy(hql, hqlParameters, batchSize); + return topiaDAO.findAllLazy(hql +(fromHql?"":" ORDER BY id"), hqlParameters, batchSize); } @Override
participants (1)
-
tchemit@users.nuiton.org