From 2658a51490861c37797721d869b282702d1a2e88 Mon Sep 17 00:00:00 2001
From: Fredrik Friis <fred-fri@dsv.su.se>
Date: Wed, 29 Feb 2012 12:38:49 +0900
Subject: [PATCH] order by for keywords added

---
 .../java/se/su/dsv/scipro/match/dao/jpa/KeywordDaoJPAImp.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/se/su/dsv/scipro/match/dao/jpa/KeywordDaoJPAImp.java b/src/main/java/se/su/dsv/scipro/match/dao/jpa/KeywordDaoJPAImp.java
index 9b4860b570..1f6914edb7 100644
--- a/src/main/java/se/su/dsv/scipro/match/dao/jpa/KeywordDaoJPAImp.java
+++ b/src/main/java/se/su/dsv/scipro/match/dao/jpa/KeywordDaoJPAImp.java
@@ -94,9 +94,9 @@ public class KeywordDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Keyword> imple
 			public List<Keyword> doInJpa(EntityManager em) throws PersistenceException {
 				TypedQuery<Keyword> query;
 				if(includeLazyDeleted)
-					query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type", domainClass);
+					query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type ORDER BY keyword", domainClass);
 				else
-					query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type AND x.deleted = false", domainClass);
+					query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type AND x.deleted = false ORDER BY keyword", domainClass);
 				query.setParameter("type", keywordType);
 				query.setHint(QueryHints.HINT_CACHEABLE, "true");
 				return query.getResultList();