← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17612: minor fix

 

------------------------------------------------------------
revno: 17612
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-11-29 12:27:08 +0700
message:
  minor fix
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2014-11-29 05:00:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2014-11-29 05:27:08 +0000
@@ -38,7 +38,7 @@
     </set>
 
     <set name="compulsoryDataElementOperands" table="datasetoperands" cascade="all-delete-orphan">
-g      <key column="datasetid" foreign-key="fk_datasetoperands_datasetid" />
+      <key column="datasetid" foreign-key="fk_datasetoperands_datasetid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementOperand" column="dataelementoperandid"
         foreign-key="fk_dataset_dataelementoperandid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2014-11-29 05:00:47 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2014-11-29 05:27:08 +0000
@@ -1004,22 +1004,29 @@
 
         private void saveDataElementOperands( T object, String fieldName, Collection<DataElementOperand> dataElementOperands )
         {
+            Collection<DataElementOperand> detachedDataElementOperands = ReflectionUtils.invokeGetterMethod( fieldName, object );
+
+            if ( detachedDataElementOperands == null )
+            {
+                return;
+            }
+
             for ( DataElementOperand dataElementOperand : dataElementOperands )
             {
                 Map<Field, Object> identifiableObjects = detachFields( dataElementOperand );
                 reattachFields( dataElementOperand, identifiableObjects );
 
+                dataElementOperand.setId( 0 );
                 dataElementOperandService.addDataElementOperand( dataElementOperand );
-                sessionFactory.getCurrentSession().flush();
             }
 
-            Collection<DataElementOperand> detachedDataElementOperands = ReflectionUtils.invokeGetterMethod( fieldName, object );
-
+            /*
             if ( detachedDataElementOperands == null )
             {
                 detachedDataElementOperands = ReflectionUtils.newCollectionInstance( dataElementOperands.getClass() );
                 ReflectionUtils.invokeSetterMethod( fieldName, object, detachedDataElementOperands );
             }
+            */
 
             detachedDataElementOperands.clear();
             detachedDataElementOperands.addAll( dataElementOperands );