fix term loading bug
authorAndreas Müller <a.mueller@bgbm.org>
Fri, 1 Nov 2013 17:30:12 +0000 (17:30 +0000)
committerAndreas Müller <a.mueller@bgbm.org>
Fri, 1 Nov 2013 17:30:12 +0000 (17:30 +0000)
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/TermVocabularyDaoImpl.java

index 0ea8469586f53716cb1c5ff5471b176647056119..9a1a4e42a1298f02714d0b267c6130a05a705b0c 100644 (file)
@@ -250,6 +250,24 @@ public class TermVocabularyDaoImpl extends IdentifiableDaoBase<TermVocabulary> i
                query.setParameterList("uuids",missingTermCandidateUuids);\r
                List<?> persistedUuids = query.list();\r
 \r
+               \r
+               //fully load and initialize vocabularies if required\r
+               if (vocabularyResponse != null){\r
+                       String hql2 = " SELECT voc " +\r
+                                       " FROM TermVocabulary voc left join fetch voc.terms terms left join fetch terms.representations representations " +\r
+                                               " left join fetch voc.representations vocReps " +\r
+                                       " WHERE terms.uuid IN (:termUuids) OR  (  voc.uuid IN (:vocUuids) AND voc.terms is empty ) " +\r
+//                                     " WHERE  voc.uuid IN (:vocUuids) AND voc.terms is empty  " +\r
+                                       " ORDER BY voc.uuid ";\r
+                       query = getSession().createQuery(hql2);\r
+                       query.setParameterList("termUuids",missingTermCandidateUuids);\r
+                       query.setParameterList("vocUuids",uuidsRequested.keySet());\r
+                       List<TermVocabulary> o = query.list();\r
+                       for (TermVocabulary<?> voc : o){\r
+                               vocabularyResponse.put(voc.getUuid(), voc);\r
+                       }\r
+               }\r
+               \r
                //compute missing terms\r
                if (missingTermCandidateUuids.size() == persistedUuids.size()){\r
                        missingTermCandidateUuids.clear();\r
@@ -270,23 +288,7 @@ public class TermVocabularyDaoImpl extends IdentifiableDaoBase<TermVocabulary> i
                                }\r
                        }\r
                }\r
-               \r
-               //fully load and initialize vocabularies if required\r
-               if (vocabularyResponse != null){\r
-                       String hql2 = " SELECT voc " +\r
-                                       " FROM TermVocabulary voc left join fetch voc.terms terms left join fetch terms.representations representations " +\r
-                                               " left join fetch voc.representations vocReps " +\r
-                                       " WHERE terms.uuid IN (:termUuids) OR  (  voc.uuid IN (:vocUuids) AND voc.terms is empty ) " +\r
-//                                     " WHERE  voc.uuid IN (:vocUuids) AND voc.terms is empty  " +\r
-                                       " ORDER BY voc.uuid ";\r
-                       query = getSession().createQuery(hql2);\r
-                       query.setParameterList("termUuids",missingTermCandidateUuids);\r
-                       query.setParameterList("vocUuids",uuidsRequested.keySet());\r
-                       List<TermVocabulary> o = query.list();\r
-                       for (TermVocabulary<?> voc : o){\r
-                               vocabularyResponse.put(voc.getUuid(), voc);\r
-                       }\r
-               }\r
+\r
 \r
                return;\r
        }\r