From: rkv Date: Thu, 14 Mar 2013 08:56:37 +0000 (+0000) Subject: Fix of hibernate exception when loading on empty database. X-Git-Tag: Root_Delivery2_2013_04_22~101 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0567c4c52ff7fc2781b5aca237b0fdece7a63638;p=tools%2Fsiman.git Fix of hibernate exception when loading on empty database. --- 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()