From 0567c4c52ff7fc2781b5aca237b0fdece7a63638 Mon Sep 17 00:00:00 2001 From: rkv Date: Thu, 14 Mar 2013 08:56:37 +0000 Subject: [PATCH] Fix of hibernate exception when loading on empty database. --- .../org/splat/service/KnowledgeElementTypeServiceImpl.java | 5 +++++ .../splat/service/technical/ProjectSettingsServiceImpl.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementTypeServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementTypeServiceImpl.java index db8e4cf..e95291e 100644 --- a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementTypeServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementTypeServiceImpl.java @@ -46,6 +46,7 @@ public class KnowledgeElementTypeServiceImpl implements * the new type name * @return the created knowledge type */ + @Transactional public KnowledgeElementType createType(final String name) { KnowledgeElementType kelt = getKnowledgeElementTypeDAO() .findByCriteria(Restrictions.eq("name", name)); @@ -63,6 +64,7 @@ public class KnowledgeElementTypeServiceImpl implements * * @return the list of all knowledge types */ + @Transactional public List selectAllTypes() { return getKnowledgeElementTypeDAO().getAll(Order.asc("rid")); } @@ -74,6 +76,7 @@ public class KnowledgeElementTypeServiceImpl implements * the progress state * @return the list of found knowledge types */ + @Transactional public List selectTypesWhere(final ProgressState state) { return getKnowledgeElementTypeDAO().getFilteredList( Restrictions.eq("state", state), Order.asc("rid")); @@ -86,6 +89,7 @@ public class KnowledgeElementTypeServiceImpl implements * the knowledge type name * @return the found knowledge type */ + @Transactional public KnowledgeElementType selectType(final String name) { return getKnowledgeElementTypeDAO().findByCriteria( Restrictions.eq("name", name)); @@ -98,6 +102,7 @@ public class KnowledgeElementTypeServiceImpl implements * the id of a knowledge type * @return the found knowledge type */ + @Transactional public KnowledgeElementType selectType(final long index) { return getKnowledgeElementTypeDAO().get(index); } diff --git a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java index f079a5a..926195b 100644 --- a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java @@ -420,6 +420,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService, /** * Initialize the database: create all necessary default staff defined in the configuration file. */ + @Transactional protected void initialize() { createDocumentTypes(); createSimulationContextTypes(); @@ -867,6 +868,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService, /** * Create in the database knowledge types defined in the custom configuration. */ + @Transactional private void createKnowledgeElementTypes() { try { KnowledgeElementType ktype = getKnowledgeElementTypeService() -- 2.39.2