]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Test data are not saved now in the test database due to transactions rollbacks. User...
authorrkv <rkv@opencascade.com>
Wed, 28 Nov 2012 09:11:33 +0000 (09:11 +0000)
committerrkv <rkv@opencascade.com>
Wed, 28 Nov 2012 09:11:33 +0000 (09:11 +0000)
Workspace/Siman-Common/src/org/splat/service/UserServiceImpl.java
Workspace/Siman-Common/src/test/splat/common/BaseTest.java
Workspace/Siman-Common/src/test/splat/dao/TestKnowledgeElementDAO.java
Workspace/Siman-Common/src/test/splat/service/TestProjectSettingsService.java
Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java
Workspace/Siman-Common/src/test/spring/ut-datasourceContext.xml

index 6c672317b4a5c7ccf6deefc2b7e8164948ff05a1..94ba43aeb1a30d0e4bbd326620b3b098de30a4c4 100644 (file)
@@ -69,9 +69,10 @@ public class UserServiceImpl implements UserService {
                        MultiplyDefinedException, RuntimeException {
                User nuser = new User(uprop);
                // Do merge to synchronize Role object with the current hibernate session
-               // and to avoid th exception:
+               // and to avoid the exception:
                // org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the
                // session: [org.splat.dal.bo.kernel.Role#simer]
+               getUserDAO().merge(nuser);
                getUserDAO().saveOrUpdate(nuser);
                
                //getUserDAO().create(nuser);
index 519e4bcdb802fad8b7899d3570fc3a3fafa8f13b..fb7af6c287a141c9d78dff7d4878de27a8aa3601 100644 (file)
@@ -19,12 +19,12 @@ import org.splat.log.AppLogger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
-import org.springframework.jdbc.datasource.DataSourceTransactionManager;
 import org.springframework.orm.hibernate3.HibernateTemplate;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.transaction.TransactionConfiguration;
 import org.springframework.transaction.TransactionDefinition;
 import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.AbstractPlatformTransactionManager;
 import org.springframework.transaction.support.DefaultTransactionDefinition;
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
@@ -220,8 +220,8 @@ public class BaseTest extends TestListingAndOrder {
         * @see test.areva.hewis.mlst2.service.gpao.rpta.TaBaseService#rollbackNestedTransaction()     
         */
        protected void startNestedTransaction() {
-               DataSourceTransactionManager txManager = 
-                       (DataSourceTransactionManager) applicationContext.getBean("txManager");
+               AbstractPlatformTransactionManager txManager = 
+                       (AbstractPlatformTransactionManager) applicationContext.getBean("txManager");
                
                DefaultTransactionDefinition txDefinition = new DefaultTransactionDefinition();
                txDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_NESTED);
@@ -234,8 +234,8 @@ public class BaseTest extends TestListingAndOrder {
         * @see test.areva.hewis.mlst2.service.gpao.rpta.TaBaseService#startNestedTransaction()
         */
        protected void rollbackNestedTransaction() {
-               DataSourceTransactionManager txManager = 
-                       (DataSourceTransactionManager) applicationContext.getBean("txManager");
+               AbstractPlatformTransactionManager txManager = 
+                       (AbstractPlatformTransactionManager) applicationContext.getBean("txManager");
                txManager.rollback(_nestedTxStatus);
        }
        
index 77ede0c2ed385391b3556115af9795ecce2c8262..42df6a20203e017aec061f8273cd167342f6fec2 100644 (file)
@@ -83,7 +83,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
        public void testCreate() throws InvalidPropertyException,
                        MissedPropertyException, MultiplyDefinedException {
                LOG.debug(">>>>> BEGIN testCreate()");
-
+               startNestedTransaction();
+               
                KnowledgeElement aKelm = getKnowledgeElement();
                // Call DAO's create method for a good transient knowledge element.
                Long id = _knowledgeElementDAO.create(aKelm);
@@ -113,6 +114,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
                        LOG.debug("Expected exception is thrown: "
                                        + e.getClass().getSimpleName() + ": " + e.getMessage());
                }
+               
+               rollbackNestedTransaction();
                LOG.debug(">>>>> END testCreate()");
        }
 
@@ -149,6 +152,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
        public void testGet() throws InvalidPropertyException,
                        MissedPropertyException, MultiplyDefinedException {
                LOG.debug(">>>>> BEGIN testGet()");
+               startNestedTransaction();
+               
                KnowledgeElement aKelm = getKnowledgeElement();
                // Call DAO's create method for a good transient knowledge element.
                Long id = _knowledgeElementDAO.create(aKelm);
@@ -189,6 +194,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
                        LOG.debug("Expected exception is thrown: "
                                        + e.getClass().getSimpleName() + ": " + e.getMessage());
                }
+               
+               rollbackNestedTransaction();
                LOG.debug(">>>>> END testGet()");
        }
 
@@ -229,6 +236,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
        public void testUpdate() throws InvalidPropertyException,
                        MissedPropertyException, MultiplyDefinedException {
                LOG.debug(">>>>> BEGIN testUpdate()");
+               startNestedTransaction();
+
                KnowledgeElement aKelm = getKnowledgeElement();
                // Call DAO's create method for a good transient knowledge element.
                Long id = _knowledgeElementDAO.create(aKelm);
@@ -290,6 +299,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
                        LOG.debug("Expected exception is thrown: "
                                        + e.getClass().getSimpleName() + ": " + e.getMessage());
                }
+               
+               rollbackNestedTransaction();
                LOG.debug(">>>>> END testUpdate()");
        }
 
@@ -326,6 +337,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
        public void testDelete() throws InvalidPropertyException,
                        MissedPropertyException, MultiplyDefinedException {
                LOG.debug(">>>>> BEGIN testDelete()");
+               startNestedTransaction();
+
                KnowledgeElement aKelm = getKnowledgeElement();
                // Call DAO's create method for a good transient knowledge element.
                Long id = _knowledgeElementDAO.create(aKelm);
@@ -349,6 +362,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
                        LOG.debug("Expected exception is thrown: "
                                        + e.getClass().getSimpleName() + ": " + e.getMessage());
                }
+               
+               rollbackNestedTransaction();
                LOG.debug(">>>>> END testDelete()");
        }
 
@@ -419,8 +434,8 @@ public class TestKnowledgeElementDAO extends BaseTest {
         * @param anExpected
         *            the expected object
         */
-       private void compareObjects(KnowledgeElement anActual,
-                       KnowledgeElement anExpected) {
+       private void compareObjects(final KnowledgeElement anActual,
+                       final KnowledgeElement anExpected) {
                Assert.assertNotNull(anActual,
                                "Created object is not found in the database.");
                Assert.assertEquals(anActual.getAuthor(), anExpected.getAuthor(),
index cfc6fe25d0f7fb3fa98b4e82acf22b1b777cab4f..d0807aec0d71d92d288c3b94f5ff7f24df82dd4a 100644 (file)
@@ -21,6 +21,7 @@ import org.splat.service.technical.ProjectSettingsService;
 import org.splat.service.technical.ProjectSettingsService.Step;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.dao.DuplicateKeyException;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -86,7 +87,8 @@ public class TestProjectSettingsService extends BaseTest {
         */
        @Test
        public void testLoadMappings() throws IOException, SQLException {
-               LOG.debug(">>>>> BEGIN testGetScenarioInfo()");
+               LOG.debug(">>>>> BEGIN testLoadMappings()()");
+               startNestedTransaction();
                // ////// Load good workflow customization
                /*
                 * geometry: brep model: med loads: c3m results: med
@@ -132,7 +134,8 @@ public class TestProjectSettingsService extends BaseTest {
                        LOG.debug("Configuration file must not be found.", e);
                }
 
-               LOG.debug(">>>>> END testGetScenarioInfo()");
+               rollbackNestedTransaction();
+               LOG.debug(">>>>> END testLoadMappings()()");
        }
 
        /**
@@ -213,6 +216,7 @@ public class TestProjectSettingsService extends BaseTest {
        @Test
        public void testLoadDefaultDocTypes() throws IOException, SQLException {
                LOG.debug(">>>>> BEGIN testLoadDefaultDocTypes()");
+               startNestedTransaction();
                // ////// Load good workflow customization
                /*
                 * geometry: brep model: med loads: c3m results: med
@@ -418,6 +422,82 @@ public class TestProjectSettingsService extends BaseTest {
                        LOG.debug("Configuration file must not be found.", e);
                }
 
+               rollbackNestedTransaction();
                LOG.debug(">>>>> END testLoadDefaultDocTypes()");
        }
+
+       /**
+        * Test of repeated database configuration method (dynamic reconfiguration).<BR>
+        * The problem - duplication of the simer user admin role. <B>Description :</B> <BR>
+        * <i>Load customization twice and check the result.</i><BR>
+        * <B>Action : </B><BR>
+        * <i>1. call the method twice for som.xml</i><BR>
+        * <B>Test data : </B><BR>
+        * <i>test/som.xml</i><BR>
+        * 
+        * <B>Outcome results:</B><BR>
+        * <i>
+        * <ul>
+        * <li>step must be configured<BR>
+        * </li>
+        * </ul>
+        * </i>
+        * 
+        * @throws IOException
+        *             if configuration loading is failed
+        * @throws SQLException
+        *             if configuration loading is failed
+        */
+       @Test
+       public void testConfigure() throws IOException, SQLException {
+               LOG.debug(">>>>> BEGIN testConfigure()");
+               startNestedTransaction();
+               // ///////////////////////////////////////////////////
+               // ////// Load good workflow customization
+               _projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
+               try {
+                       _projectSettings.configure(ClassLoader.getSystemResource(
+                                       "test/som.xml").getPath());
+               } catch (FileNotFoundException e) {
+                       Assert.fail("Can't find configuration file: ", e);
+               }
+
+               List<Step> steps = _projectSettings.getStepsOf(Scenario.class);
+               Assert.assertTrue(steps.size() > 0, "No steps are created.");
+
+               // /////////////////////////////////////////////////////////
+               // ////// Test reconfiguration attempt
+               Database.getInstance().reset();
+               _projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
+               try {
+                       _projectSettings.configure(ClassLoader.getSystemResource(
+                                       "test/som.xml").getPath());
+               } catch (FileNotFoundException e) {
+                       Assert.fail("Can't find configuration file: ", e);
+               }
+               steps = _projectSettings.getStepsOf(Scenario.class);
+               Assert.assertTrue(steps.size() > 0, "No steps are created.");
+
+               try {
+                       /*
+                        * The next call to flush() must not throw the following exception: org.springframework.dao.DuplicateKeyException: a different
+                        * object with the same identifier value was already associated with the session: [org.splat.dal.bo.kernel.Role#simer]; nested
+                        * exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated
+                        * with the session: [org.splat.dal.bo.kernel.Role#simer] at
+                        * org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:662) at
+                        * org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at
+                        * org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) at
+                        * org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) at
+                        * org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:881)
+                        */
+                       getHibernateTemplate().flush();
+               } catch (DuplicateKeyException dke) {
+                       Assert.fail(
+                                       "User creation failed during the database reconfiguration: "
+                                                       + dke.getMessage(), dke);
+               }
+
+               rollbackNestedTransaction();
+               LOG.debug(">>>>> END testConfigure()");
+       }
 }
index 005ddfb5033494c5e8203c87d5a7cfc0f8431727..3670fa28dc249bb983ebd20dcc79b3fa78510328 100644 (file)
@@ -156,6 +156,8 @@ public class TestScenarioService extends BaseTest {
                        MissedPropertyException, MultiplyDefinedException, IOException,
                        SQLException {
                LOG.debug(">>>>> BEGIN testGetScenarioInfo()");
+               startNestedTransaction();
+               
                long scenarioId = createScenario();
                // Call DAO's create method for a good transient knowledge element.
                List<StepDTO> steps = _scenarioService.getScenarioInfo(scenarioId);
@@ -234,7 +236,7 @@ public class TestScenarioService extends BaseTest {
                                                                }
                                                        } else { // Outdated
                                                                Assert.assertEquals(file.getState(), 'O',
-                                                                               "File state must be actual ('O').");
+                                                                               "File state must be outdated ('O').");
                                                                Assert
                                                                                .assertEquals(file.getProcessing(),
                                                                                                "file-download",
@@ -257,6 +259,7 @@ public class TestScenarioService extends BaseTest {
                        LOG.debug("Expected exception is thrown: "
                                        + e.getClass().getSimpleName() + ": " + e.getMessage());
                }
+               rollbackNestedTransaction();
                LOG.debug(">>>>> END testGetScenarioInfo()");
        }
 
@@ -314,9 +317,12 @@ public class TestScenarioService extends BaseTest {
                        MissedPropertyException, MultiplyDefinedException, IOException,
                        SQLException, MismatchException, NotApplicableException {
                LOG.debug(">>>>> BEGIN testCheckin()");
+               startNestedTransaction();
+               
                _projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
                _projectSettings.configure(ClassLoader
                                .getSystemResource("test/som.xml").getPath());
+               getHibernateTemplate().flush();
                long scenarioId = createScenario();
                Scenario aScen = _scenarioDAO.get(scenarioId);
                User user = aScen.getAuthor();
@@ -465,7 +471,8 @@ public class TestScenarioService extends BaseTest {
                        LOG.debug("Expected exception is thrown: "
                                        + e.getClass().getSimpleName() + ": " + e.getMessage());
                }
-
+               
+               rollbackNestedTransaction();
                LOG.debug(">>>>> END testCheckin()");
        }
 
index 8b57e51e97eef97fbf47e9e9ed321e42053bcc9b..7ac2d9aa25228d8020e02eb1edd0a4e94f35b872 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xmlns:aop="http://www.springframework.org/schema/aop"
-    xmlns:context="http://www.springframework.org/schema/context"
-    xmlns:tx="http://www.springframework.org/schema/tx"
-    xsi:schemaLocation="
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="
 http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
 http://www.springframework.org/schema/aop
@@ -14,113 +14,113 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd
 http://www.springframework.org/schema/tx
 http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
 
-    <!--    <bean id="simanDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
-        <property name="jndiName" value="jdbc/ibatis"/>
-        </bean> -->
+       <!--    <bean id="simanDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
+               <property name="jndiName" value="jdbc/ibatis"/>
+               </bean> -->
 
-    <!--    <bean id="simanDatasource"
-        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
-        <property name="driverClassName"
-            value="${connection.driver_class}" />
-        <property name="url" value="${connection.url}" />
-        <property name="username" value="${connection.username}" />
-        <property name="password" value="${connection.password}" />
-    </bean>
-    -->
+       <bean id="simanDatasource"
+               class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+               <property name="driverClassName"
+                       value="${connection.driver_class}" />
+               <property name="url" value="${connection.url}" />
+               <property name="username" value="${connection.username}" />
+               <property name="password" value="${connection.password}" />
+       </bean>
 
-    <bean id="simanDatasource"
-        class="org.springframework.jdbc.datasource.SingleConnectionDataSource">
-        <property name="driverClassName"
-            value="${connection.driver_class}" />
-        <property name="url" value="${connection.url}" />
-        <property name="username" value="${connection.username}" />
-        <property name="password" value="${connection.password}" />
-        <property name="suppressClose" value="true" />
-        <property name="autoCommit" value="false" />
-    </bean>
+       <!--    <bean id="simanDatasource"
+               class="org.springframework.jdbc.datasource.SingleConnectionDataSource">
+               <property name="driverClassName"
+               value="${connection.driver_class}" />
+               <property name="url" value="${connection.url}" />
+               <property name="username" value="${connection.username}" />
+               <property name="password" value="${connection.password}" />
+               <property name="suppressClose" value="true" />
+               <property name="autoCommit" value="false" />
+               </bean>-->
 
-    <bean id="p6spySimanDatasource"
-        class="com.p6spy.engine.spy.P6DataSource">
-        <constructor-arg>
-            <ref local="simanDatasource" />
-        </constructor-arg>
-    </bean>
+       <bean id="p6spySimanDatasource"
+               class="com.p6spy.engine.spy.P6DataSource">
+               <constructor-arg>
+                       <ref local="simanDatasource" />
+               </constructor-arg>
+       </bean>
 
 
-    <bean id="hibernateProperties"
-        class="org.springframework.beans.factory.config.PropertiesFactoryBean">
-        <property name="properties">
-            <props>
-                <!-- normal properties -->
-            </props>
-        </property>
-        <!-- hibernate.config should be defined somewhere in the spring.properties layers -->
-        <property name="locations">
-            <list>
-                <value>classpath:test/${hibernate.config.file}</value>
-            </list>
-        </property>
-    </bean>
+       <bean id="hibernateProperties"
+               class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+               <property name="properties">
+                       <props>
+                               <!-- normal properties -->
+                       </props>
+               </property>
+               <!-- hibernate.config should be defined somewhere in the spring.properties layers -->
+               <property name="locations">
+                       <list>
+                               <value>classpath:test/${hibernate.config.file}</value>
+                       </list>
+               </property>
+       </bean>
 
-    <bean id="simanSessionFactory"
-        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
-        <property name="dataSource" ref="simanDatasource" />
-        <property name="mappingResources">
-            <list>
-                <value>
-                    org/splat/dal/bo/kernel/Persistent.hbm.xml
-                </value>
-                <value>org/splat/dal/bo/kernel/Any.hbm.xml</value>
-                <value>org/splat/dal/bo/kernel/Entity.hbm.xml</value>
-                <value>org/splat/dal/bo/kernel/Attribute.hbm.xml</value>
-                <value>org/splat/dal/bo/kernel/Relation.hbm.xml</value>
-                <value>
-                    org/splat/dal/bo/kernel/TextAttribute.hbm.xml
-                </value>
-                <value>org/splat/dal/bo/kernel/User.hbm.xml</value>
+       <bean id="simanSessionFactory"
+               class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+               <property name="dataSource" ref="simanDatasource" />
+               <property name="mappingResources">
+                       <list>
+                               <value>
+                                       org/splat/dal/bo/kernel/Persistent.hbm.xml
+                               </value>
+                               <value>org/splat/dal/bo/kernel/Any.hbm.xml</value>
+                               <value>org/splat/dal/bo/kernel/Entity.hbm.xml</value>
+                               <value>org/splat/dal/bo/kernel/Attribute.hbm.xml</value>
+                               <value>org/splat/dal/bo/kernel/Relation.hbm.xml</value>
+                               <value>
+                                       org/splat/dal/bo/kernel/TextAttribute.hbm.xml
+                               </value>
+                               <value>org/splat/dal/bo/kernel/User.hbm.xml</value>
 
-                <value>
-                    org/splat/dal/bo/som/ProjectElement.hbm.xml
-                </value>
-                <value>org/splat/dal/bo/som/Study.hbm.xml</value>
-                <value>org/splat/dal/bo/som/Scenario.hbm.xml</value>
-                <value>org/splat/dal/bo/som/Attributes.hbm.xml</value>
-                <value>org/splat/dal/bo/som/Relations.hbm.xml</value>
-                <value>org/splat/dal/bo/som/File.hbm.xml</value>
-                <value>org/splat/dal/bo/som/Document.hbm.xml</value>
-                <value>org/splat/dal/bo/som/Publication.hbm.xml</value>
-                <value>
-                    org/splat/dal/bo/som/ValidationCycle.hbm.xml
-                </value>
-                <value>org/splat/dal/bo/som/Timestamp.hbm.xml</value>
-                <value>
-                    org/splat/dal/bo/som/SimulationContext.hbm.xml
-                </value>
-                <value>
-                    org/splat/dal/bo/som/KnowledgeElement.hbm.xml
-                </value>
-                <value>org/splat/dal/bo/som/IDBuilder.hbm.xml</value>
-            </list>
-        </property>
-        <!-- hibernate.connection.driver_class=com.p6spy.engine.spy.P6SpyDriver -->
+                               <value>
+                                       org/splat/dal/bo/som/ProjectElement.hbm.xml
+                               </value>
+                               <value>org/splat/dal/bo/som/Study.hbm.xml</value>
+                               <value>org/splat/dal/bo/som/Scenario.hbm.xml</value>
+                               <value>org/splat/dal/bo/som/Attributes.hbm.xml</value>
+                               <value>org/splat/dal/bo/som/Relations.hbm.xml</value>
+                               <value>org/splat/dal/bo/som/File.hbm.xml</value>
+                               <value>org/splat/dal/bo/som/Document.hbm.xml</value>
+                               <value>org/splat/dal/bo/som/Publication.hbm.xml</value>
+                               <value>
+                                       org/splat/dal/bo/som/ValidationCycle.hbm.xml
+                               </value>
+                               <value>org/splat/dal/bo/som/Timestamp.hbm.xml</value>
+                               <value>
+                                       org/splat/dal/bo/som/SimulationContext.hbm.xml
+                               </value>
+                               <value>
+                                       org/splat/dal/bo/som/KnowledgeElement.hbm.xml
+                               </value>
+                               <value>org/splat/dal/bo/som/IDBuilder.hbm.xml</value>
+                       </list>
+               </property>
+               <!-- hibernate.connection.driver_class=com.p6spy.engine.spy.P6SpyDriver -->
 
-        <property name="hibernateProperties">
-            <ref local="hibernateProperties" />
-        </property>
-        <!-- The following property is used temporary to be able to manage transactions manually. -->
-        <!-- TODO: use annotations to mark transaction methods 
-            instead of programmatic transaction management  -->
-<!--         <property name="exposeTransactionAwareSessionFactory">
-            <value>false</value>
-        </property>-->
-<!--         <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />-->
-    </bean>
+               <property name="hibernateProperties">
+                       <ref local="hibernateProperties" />
+               </property>
+               <!-- The following property is used temporary to be able to manage transactions manually. -->
+               <!-- TODO: use annotations to mark transaction methods 
+                       instead of programmatic transaction management  -->
+               <!--         <property name="exposeTransactionAwareSessionFactory">
+                       <value>false</value>
+                       </property>-->
+               <!--         <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />-->
+       </bean>
 
-    <bean id="txManager"
-        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
-        <property name="sessionFactory" ref="simanSessionFactory" />
-    </bean>
+       <bean id="txManager"
+               class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+               <property name="sessionFactory" ref="simanSessionFactory" />
+               <property name="nestedTransactionAllowed" value="true" />
+       </bean>
 
-    <tx:annotation-driven transaction-manager="txManager" />
+       <tx:annotation-driven transaction-manager="txManager" />
 
 </beans>