← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3502: Put explicit names on all foreign keys

 

------------------------------------------------------------
revno: 3502
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-05-02 16:48:05 +0200
message:
  Put explicit names on all foreign keys
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/resources/org/hisp/dhis/datalock/hibernate/DataSetLock.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml
  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/Section.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/expression/hibernate/Expression.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/Message.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/User.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserAuthorityGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserCredentials.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserSetting.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRuleGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml
  dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifier.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardContent.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml


--
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-administration/src/main/resources/org/hisp/dhis/datalock/hibernate/DataSetLock.hbm.xml'
--- dhis-2/dhis-services/dhis-service-administration/src/main/resources/org/hisp/dhis/datalock/hibernate/DataSetLock.hbm.xml	2011-04-22 17:02:27 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/org/hisp/dhis/datalock/hibernate/DataSetLock.hbm.xml	2011-05-02 14:48:05 +0000
@@ -10,14 +10,14 @@
       <generator class="native" />
     </id>
 
-    <many-to-one name="dataSet" class="org.hisp.dhis.dataset.DataSet" lazy="false" column="datasetid"
+    <many-to-one name="dataSet" class="org.hisp.dhis.dataset.DataSet" column="datasetid"
       not-null="true" foreign-key="fk_dataset_datasetid" />
 
-    <many-to-one name="period" class="org.hisp.dhis.period.Period" lazy="false" column="periodid" not-null="true"
+    <many-to-one name="period" class="org.hisp.dhis.period.Period" column="periodid" not-null="true"
       foreign-key="fk_dataset_periodid" />
 
     <set name="sources" table="datasetlocksource">
-      <key column="datasetlockid" />
+      <key column="datasetlockid" foreign-key="fk_datasetlocksource_datasetlockid" />
       <many-to-many column="sourceid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_datasetlock_organisationunit"/>
     </set>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml	2011-05-02 14:48:05 +0000
@@ -21,13 +21,13 @@
     <property name="region" />
 
     <set name="dataElements" table="datadictionarydataelements">
-      <key column="datadictionaryid" />
-      <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" />
+      <key column="datadictionaryid" foreign-key="fk_datadictionarydataelements_datadictionaryid" />
+      <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_datadictionarydataelements_dataelementid" />
     </set>
 
     <set name="indicators" table="datadictionaryindicators">
-      <key column="datadictionaryid" />
-      <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" />
+      <key column="datadictionaryid" foreign-key="fk_datadictionaryindicators_datadictionaryid" />
+      <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" foreign-key="fk_datadictionaryindicators_indicatorid" />
     </set>
 
   </class>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2011-04-30 09:28:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2011-05-02 14:48:05 +0000
@@ -66,7 +66,7 @@
     </set>
 
     <list name="aggregationLevels" table="dataelementaggregationlevels">
-      <key column="dataelementid" />
+      <key column="dataelementid" foreign-key="fk_dataelementaggregationlevels_dataelementid" />
       <list-index column="sort_order" base="0" />
       <element column="aggregationlevel" type="integer" />
     </list>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml	2011-04-24 11:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml	2011-05-02 14:48:05 +0000
@@ -25,7 +25,7 @@
 
     <list name="categoryOptions" table="categories_categoryoptions">
       <cache usage="read-write" />
-      <key column="categoryid" />
+      <key column="categoryid" foreign-key="fk_categories_categoryoptions_categoryid" />
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOption" column="categoryoptionid"
         foreign-key="fk_category_categoryoptionid" unique="true" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml	2011-04-24 11:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml	2011-05-02 14:48:05 +0000
@@ -18,7 +18,7 @@
 
     <list name="categories" table="categorycombos_categories">
       <cache usage="read-write" />
-      <key column="categorycomboid" />
+      <key column="categorycomboid" foreign-key="fk_categorycombos_categories_categorycomboid" />
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategory" column="categoryid"
         foreign-key="fk_categorycombo_categoryid" />
@@ -26,7 +26,7 @@
 
     <set name="optionCombos" table="categorycombos_optioncombos" inverse="true" cascade="all">
       <cache usage="read-write" />
-      <key column="categorycomboid" />
+      <key column="categorycomboid" foreign-key="fk_categorycombos_optioncombos_categorycomboid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" column="categoryoptioncomboid"
         foreign-key="fk_categorycombo_categoryoptioncomboid" unique="true" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml	2011-04-24 11:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml	2011-05-02 14:48:05 +0000
@@ -19,7 +19,7 @@
 
     <set name="categoryOptionCombos" table="categoryoptioncombos_categoryoptions" inverse="true">
       <cache usage="read-write" />
-      <key column="categoryoptionid" />
+      <key column="categoryoptionid" foreign-key="fk_categoryoptioncombos_categoryoptions_categoryoptionid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" column="categoryoptioncomboid"
         foreign-key="fk_categoryoption_categoryoptioncomboid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml	2011-04-24 11:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml	2011-05-02 14:48:05 +0000
@@ -18,7 +18,7 @@
 
     <list name="categoryOptions" table="categoryoptioncombos_categoryoptions">
       <cache usage="read-write" />
-      <key column="categoryoptioncomboid" />
+      <key column="categoryoptioncomboid" foreign-key="fk_categoryoptioncombos_categoryoptions_categoryoptioncomboid" />
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOption" column="categoryoptionid"
         foreign-key="fk_categoryoptioncombo_categoryoptionid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml	2011-04-30 09:28:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml	2011-05-02 14:48:05 +0000
@@ -22,7 +22,7 @@
 
     <set name="members" table="dataelementgroupmembers">
       <cache usage="read-write" />
-      <key column="dataelementgroupid" />
+      <key column="dataelementgroupid" foreign-key="fk_dataelementgroupmembers_dataelementgroupid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
         foreign-key="fk_dataelementgroup_dataelementid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml	2011-04-30 09:28:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml	2011-05-02 14:48:05 +0000
@@ -22,7 +22,7 @@
 
     <list name="members" table="dataelementgroupsetmembers">
       <cache usage="read-write" />
-      <key column="dataelementgroupsetid" />
+      <key column="dataelementgroupsetid" foreign-key="fk_dataelementgroupsetmembers_dataelementgroupsetid"/>
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementGroup" column="dataelementgroupid" unique="true"
         foreign-key="fk_dataelementgroupset_dataelementgroupid" />

=== 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	2011-04-24 12:17:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2011-05-02 14:48:05 +0000
@@ -27,19 +27,19 @@
 
     <set name="dataElements" table="datasetmembers">
       <cache usage="read-write" />
-      <key column="datasetid" />
+      <key column="datasetid" foreign-key="fk_datasetmembers_datasetid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_dataset_dataelementid" />
     </set>
 
     <set name="compulsoryDataElementOperands" table="datasetoperands" cascade="all-delete-orphan">
-      <key column="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>
 
     <set name="sources" table="datasetsource">
       <cache usage="read-write" />
-      <key column="datasetid" />
+      <key column="datasetid" foreign-key="fk_datasetsource_datasetid" />
       <many-to-many column="sourceid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_dataset_organisationunit"/>
     </set>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/Section.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/Section.hbm.xml	2011-04-24 11:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/Section.hbm.xml	2011-05-02 14:48:05 +0000
@@ -14,18 +14,18 @@
 
     <property name="name" not-null="true" unique-key="key_sectionnamedataset" />
 
-    <many-to-one name="dataSet" class="org.hisp.dhis.dataset.DataSet" column="datasetid" unique-key="key_sectionnamedataset" />
+    <many-to-one name="dataSet" class="org.hisp.dhis.dataset.DataSet" column="datasetid" unique-key="key_sectionnamedataset" foreign-key="fk_section_datasetid" />
 
     <list name="dataElements" table="sectiondataelements">
       <cache usage="read-write" />
-      <key column="sectionid" />
+      <key column="sectionid" foreign-key="fk_sectiondataelements_sectionid" />
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_section_dataelementid" />
     </list>
 
     <set name="greyedFields" table="sectiongreyedfields">
       <cache usage="read-write" />
-      <key column="sectionid" />
+      <key column="sectionid" foreign-key="fk_sectiongreyedfields_sectionid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementOperand" column="dataelementoperandid"
         foreign-key="fk_section_dataelementoperandid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/expression/hibernate/Expression.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/expression/hibernate/Expression.hbm.xml	2011-04-24 11:26:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/expression/hibernate/Expression.hbm.xml	2011-05-02 14:48:05 +0000
@@ -18,7 +18,7 @@
 
     <set name="dataElementsInExpression" table="expressiondataelement">
       <cache usage="read-write" />      
-      <key column="expressionid" />
+      <key column="expressionid" foreign-key="fk_expressiondataelement_expressionid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_expression_dataelementid" />
     </set>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml	2011-04-30 09:28:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml	2011-05-02 14:48:05 +0000
@@ -22,7 +22,7 @@
 
     <set name="members" table="indicatorgroupmembers">
       <cache usage="read-write" />
-      <key column="indicatorgroupid" />
+      <key column="indicatorgroupid" foreign-key="fk_indicatorgroupmembers_indicatorgroupid" />
       <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" foreign-key="fk_indicatorgroup_indicatorid" />
     </set>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml	2011-04-30 09:28:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml	2011-05-02 14:48:05 +0000
@@ -22,7 +22,7 @@
 
     <list name="members" table="indicatorgroupsetmembers">
       <cache usage="read-write" />
-      <key column="indicatorgroupsetid" />
+      <key column="indicatorgroupsetid" foreign-key="fk_indicatorgroupsetmembers_indicatorgroupsetid" />
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.indicator.IndicatorGroup" column="indicatorgroupid" unique="true"
         foreign-key="fk_indicatorgroupset_indicatorgroupid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/Message.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/Message.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/Message.hbm.xml	2011-05-02 14:48:05 +0000
@@ -20,7 +20,7 @@
       not-null="true" />
 
     <set name="userMessages" table="message_usermessages" cascade="save-update">
-      <key column="messageid" />
+      <key column="messageid" foreign-key="fk_message_usermessages_messageid" />
       <many-to-many class="org.hisp.dhis.message.UserMessage" column="usermessageid" unique="true"
         foreign-key="fk_message_usermessages" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml	2011-04-30 09:28:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml	2011-05-02 14:48:05 +0000
@@ -22,7 +22,7 @@
 
     <set name="members" table="orgunitgroupmembers">
       <cache usage="read-write" />
-      <key column="orgunitgroupid" />
+      <key column="orgunitgroupid" foreign-key="fk_orgunitgroupmembers_orgunitgroupid" />
       <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid"
         foreign-key="fk_orgunitgroup_organisationunitid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml	2011-04-30 09:28:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml	2011-05-02 14:48:05 +0000
@@ -21,7 +21,7 @@
 
     <set name="organisationUnitGroups" table="orgunitgroupsetmembers">
       <cache usage="read-write" />
-      <key column="orgunitgroupsetid" />
+      <key column="orgunitgroupsetid" foreign-key="fk_orgunitgroupsetmembers_orgunitgroupsetid" />
       <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid"
         foreign-key="fk_orgunitgroupset_orgunitgroupid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/User.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/User.hbm.xml	2011-04-24 13:31:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/User.hbm.xml	2011-05-02 14:48:05 +0000
@@ -22,7 +22,7 @@
 
     <set name="organisationUnits" table="usermembership">      
       <cache usage="read-write" />      
-      <key column="userinfoid" />
+      <key column="userinfoid" foreign-key="fk_usermembership_userinfoid" />
       <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid"
         foreign-key="fk_userinfo_organisationunitid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserAuthorityGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserAuthorityGroup.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserAuthorityGroup.hbm.xml	2011-05-02 14:48:05 +0000
@@ -18,17 +18,17 @@
 
     <set name="members" table="userrolemembers" inverse="true">
       <key column="userroleid" />
-      <many-to-many column="userid" class="org.hisp.dhis.user.UserCredentials" foreign-key="fk_userid" />
+      <many-to-many column="userid" class="org.hisp.dhis.user.UserCredentials"/>
     </set>
 
     <set name="authorities" table="userroleauthorities">
-      <key column="userroleid" />
+      <key column="userroleid" foreign-key="fk_userroleauthorities_userroleid" />
       <element type="string" column="authority" />
     </set>
 
     <set name="dataSets" table="userroledataset">
-      <key column="userroleid" />
-      <many-to-many column="datasetid" class="org.hisp.dhis.dataset.DataSet" foreign-key="fk_datasetid" />
+      <key column="userroleid" foreign-key="fk_userroledataset_userroleid" />
+      <many-to-many column="datasetid" class="org.hisp.dhis.dataset.DataSet" foreign-key="fk_userroledataset_datasetid" />
     </set>
 
   </class>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserCredentials.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserCredentials.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserCredentials.hbm.xml	2011-05-02 14:48:05 +0000
@@ -14,7 +14,7 @@
       </generator>
     </id>
 
-    <one-to-one name="user" class="org.hisp.dhis.user.User" constrained="true" />
+    <one-to-one name="user" class="org.hisp.dhis.user.User" constrained="true" foreign-key="fk_user_userinfoid" />
 
     <property name="username">
       <column name="username" not-null="true" unique="true" />
@@ -26,7 +26,7 @@
 
     <set name="userAuthorityGroups" table="userrolemembers" cascade="save-update">
       <cache usage="read-write" />
-      <key column="userid" />
+      <key column="userid" foreign-key="fk_userrolemembers_userid" />
       <many-to-many column="userroleid" class="org.hisp.dhis.user.UserAuthorityGroup" foreign-key="fk_userrolemembers_userroleid" />
     </set>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserGroup.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserGroup.hbm.xml	2011-05-02 14:48:05 +0000
@@ -13,7 +13,7 @@
     <property name="name" not-null="true" unique="true" length="230" />
 
     <set name="members" table="usergroupmembers">
-      <key column="usergroupid" />
+      <key column="usergroupid" foreign-key="fk_usergroupmembers_usergroupid" />
       <many-to-many column="userid" class="org.hisp.dhis.user.User" foreign-key="fk_usergroup_userid" />
     </set>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserSetting.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserSetting.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserSetting.hbm.xml	2011-05-02 14:48:05 +0000
@@ -9,7 +9,7 @@
     <cache usage="read-write" />
 
     <composite-id>
-      <key-many-to-one name="user" class="org.hisp.dhis.user.User" column="userinfoid" />
+      <key-many-to-one name="user" class="org.hisp.dhis.user.User" column="userinfoid" foreign-key="fk_usersetting_userinfoid" />
       <key-property name="name" column="name" />
     </composite-id>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml	2011-04-23 18:52:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml	2011-05-02 14:48:05 +0000
@@ -25,10 +25,10 @@
     </property>
 
     <many-to-one name="leftSide" column="leftexpressionid" class="org.hisp.dhis.expression.Expression"
-      cascade="all" />
+      cascade="all" foreign-key="fk_validationrule_leftexpressionid" />
 
     <many-to-one name="rightSide" column="rightexpressionid" class="org.hisp.dhis.expression.Expression"
-      cascade="all" />
+      cascade="all" foreign-key="fk_validationrule_rightexpressionid" />
 
     <set name="groups" table="validationrulegroupmembers" inverse="true">
       <key column="validationruleid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRuleGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRuleGroup.hbm.xml	2011-04-23 18:52:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRuleGroup.hbm.xml	2011-05-02 14:48:05 +0000
@@ -19,7 +19,7 @@
     <property name="description" type="text" />
 
     <set name="members" table="validationrulegroupmembers">
-      <key column="validationgroupid" />
+      <key column="validationgroupid" foreign-key="fk_validationrulegroupmembers_validationrulegroupid" />
       <many-to-many class="org.hisp.dhis.validation.ValidationRule" column="validationruleid"
         foreign-key="fk_validationrulegroup_validationruleid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml	2011-04-12 13:32:28 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml	2011-05-02 14:48:05 +0000
@@ -13,23 +13,23 @@
     <property name="name" column="name" unique="true" not-null="true" />
 
     <set name="dataElements" table="datamartexportdataelements">
-      <key column="datamartexportid" />
-      <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" />
+      <key column="datamartexportid" foreign-key="fk_datamartexportdataelements_datamartexportid" />
+      <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_datamartexportdataelements_dataelementid" />
     </set>
 
     <set name="indicators" table="datamartexportindicators">
-      <key column="datamartexportid" />
-      <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" />
+      <key column="datamartexportid" foreign-key="fk_datamartexportindicators_datamartexportid" />
+      <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" foreign-key="fk_datamartexportindicators_indicatorid" />
     </set>
 
     <set name="organisationUnits" table="datamartexportorgunits">
-      <key column="datamartexportid" />
-      <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnit" column="orgunitid" />
+      <key column="datamartexportid" foreign-key="fk_datamartexportorgunits_datamartexportid" />
+      <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnit" column="orgunitid" foreign-key="fk_datamartexportorgunits_organisationunitid" />
     </set>
 
     <set name="periods" table="datamartexportperiods">
-      <key column="datamartexportid" />
-      <many-to-many class="org.hisp.dhis.period.Period" column="periodid" />
+      <key column="datamartexportid" foreign-key="fk_datamartexportperiods_datamartexportid" />
+      <many-to-many class="org.hisp.dhis.period.Period" column="periodid" foreign-key="fk_datamartexportperiods_periodid" />
     </set>
 
     <component name="relatives">

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml	2011-04-12 13:38:03 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml	2011-05-02 14:48:05 +0000
@@ -23,17 +23,17 @@
     <property name="colorHigh" column="colorhigh" />
 
     <set name="mapLegends" table="maplegendsetmaplegend">
-      <key column="legendsetid" />
+      <key column="legendsetid" foreign-key="fk_maplegendsetmaplegend_legendsetid" />
       <many-to-many column="maplegendid" class="org.hisp.dhis.mapping.MapLegend" foreign-key="fk_maplegendset_maplegend" />
     </set>
 
     <set name="indicators" table="maplegendsetindicator">
-      <key column="legendsetid" />
+      <key column="legendsetid" foreign-key="fk_maplegendsetindicator_legendsetid" />
       <many-to-many column="indicatorid" class="org.hisp.dhis.indicator.Indicator" foreign-key="fk_maplegendset_indicator" />
     </set>
 
     <set name="dataElements" table="maplegendsetdataelement">
-      <key column="legendsetid" />
+      <key column="legendsetid" foreign-key="fk_maplegendsetdataelement_legendsetid" />
       <many-to-many column="dataelementid" class="org.hisp.dhis.dataelement.DataElement" foreign-key="fk_maplegendset_dataelement" />
     </set>
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2011-05-02 14:48:05 +0000
@@ -35,7 +35,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.system.startup.AbstractStartupRoutine;
 import org.springframework.transaction.annotation.Transactional;
@@ -137,8 +136,7 @@
         }
         catch ( Exception ex )
         {
-            ex.printStackTrace();
-            log.error( ex );
+            log.debug( ex );
         }
         finally
         {
@@ -196,7 +194,7 @@
         }
         catch ( Exception ex )
         {
-            log.error( ex );
+            log.debug( ex );
         }
         finally
         {

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml	2011-04-12 13:44:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml	2011-05-02 14:48:05 +0000
@@ -38,19 +38,20 @@
     </set>
 
     <set name="programs" table="patient_programs">
-      <key column="patientid" />
+      <key column="patientid" foreign-key="fk_patient_programs_patientid" />
       <many-to-many class="org.hisp.dhis.program.Program" column="programid" foreign-key="fk_patient_programid" />
     </set>
 
     <set name="attributes" table="patient_attributes">
-      <key column="patientid" />
+      <key column="patientid" foreign-key="fk_patient_attributes_patientid" />
       <many-to-many class="org.hisp.dhis.patient.PatientAttribute" column="patientattributeid" foreign-key="fk_patient_patientattributeid" />
     </set>
 
     <many-to-one name="representative" class="org.hisp.dhis.patient.Patient" column="representativeid"
       foreign-key="fk_representativeid" />
 
-    <many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid" />
+    <many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid"
+      foreign-key="fk_patient_organisationunitid" />
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifier.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifier.hbm.xml	2011-04-12 13:44:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifier.hbm.xml	2011-05-02 14:48:05 +0000
@@ -13,7 +13,7 @@
     <many-to-one name="identifierType" class="org.hisp.dhis.patient.PatientIdentifierType" column="patientidentifiertypeid"
       foreign-key="fk_patientidentifier_patientidentifiertypeid" />
 
-    <many-to-one name="patient" class="org.hisp.dhis.patient.Patient" column="patientid" not-null="true" />
+    <many-to-one name="patient" class="org.hisp.dhis.patient.Patient" column="patientid" not-null="true" foreign-key="fk_patientidentifier_patient" />
 
     <property name="identifier" length="31" not-null="true" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml	2011-04-12 13:44:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml	2011-05-02 14:48:05 +0000
@@ -26,13 +26,13 @@
     </set>
 
     <set name="organisationUnits" table="program_organisationunits">
-      <key column="programid" />
-      <many-to-many column="organisationunitid" class="org.hisp.dhis.organisationunit.OrganisationUnit" />
+      <key column="programid" foreign-key="fk_program_organisationunits_programid" />
+      <many-to-many column="organisationunitid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_program_organisationunits_organisationunitid" />
     </set>
 
     <set name="patientValidationCriteria" table="program_criteria">
-      <key column="programid" />
-      <many-to-many column="validationcriteriaid" class="org.hisp.dhis.validation.ValidationCriteria" />
+      <key column="programid" foreign-key="fk_program_criteria_programid" />
+      <many-to-many column="validationcriteriaid" class="org.hisp.dhis.validation.ValidationCriteria" foreign-key="fk_program_criteria_validationcriteriaid" />
     </set>
 
     <property name="minDaysAllowedInputData" />

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml	2011-04-12 13:44:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml	2011-05-02 14:48:05 +0000
@@ -30,7 +30,7 @@
     </set>
 
     <set name="attributes" table="programinstance_attributes">
-      <key column="programinstanceid" />
+      <key column="programinstanceid" foreign-key="fk_programinstance_attributes_programinstanceid" />
       <many-to-many class="org.hisp.dhis.program.ProgramAttribute" column="programattributeid" foreign-key="fk_program_programattributeid" />
     </set>
 

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2011-05-02 12:54:28 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2011-05-02 14:48:05 +0000
@@ -36,23 +36,23 @@
 
     <list name="indicators" table="chart_indicators">
       <cache usage="read-write" />
-      <key column="chartid" />
+      <key column="chartid" foreign-key="fk_chart_indicators_chartid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="indicatorid" class="org.hisp.dhis.indicator.Indicator" />
+      <many-to-many column="indicatorid" class="org.hisp.dhis.indicator.Indicator" foreign-key="fk_chart_indicators_indicatorid" />
     </list>
 
     <list name="periods" table="chart_periods">
       <cache usage="read-write" />
-      <key column="chartid" />
+      <key column="chartid" foreign-key="fk_chart_periods_chartid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="periodid" class="org.hisp.dhis.period.Period" />
+      <many-to-many column="periodid" class="org.hisp.dhis.period.Period" foreign-key="fk_chart_periods_periodid" />
     </list>
 
     <list name="organisationUnits" table="chart_organisationunits">
       <cache usage="read-write" />
-      <key column="chartid" />
+      <key column="chartid" foreign-key="fk_chart_organisationunits_chartid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="organisationunitid" class="org.hisp.dhis.organisationunit.OrganisationUnit" />
+      <many-to-many column="organisationunitid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_chart_organisationunits_organisationunitid" />
     </list>
 
     <component name="relatives">

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardContent.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardContent.hbm.xml	2011-04-24 12:47:31 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardContent.hbm.xml	2011-05-02 14:48:05 +0000
@@ -17,27 +17,27 @@
     <one-to-one name="user" class="org.hisp.dhis.user.User" constrained="true" />
 
     <list name="reports" table="dashboardcontent_reports">
-      <key column="userid" />
+      <key column="userid" foreign-key="fk_dashboardcontent_reports_userid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="reportid" class="org.hisp.dhis.report.Report" />
+      <many-to-many column="reportid" class="org.hisp.dhis.report.Report" foreign-key="fk_dashboardcontent_reports_reportid" />
     </list>
 
     <list name="documents" table="dashboardcontent_documents">
-      <key column="userid" />
+      <key column="userid" foreign-key="fk_dashboardcontent_documents_userid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="documentid" class="org.hisp.dhis.document.Document" />
+      <many-to-many column="documentid" class="org.hisp.dhis.document.Document" foreign-key="fk_dashboardcontent_documents_documentid" />
     </list>
 
     <list name="reportTables" table="dashboardcontent_reporttables">
-      <key column="userid" />
+      <key column="userid" foreign-key="fk_dashboardcontent_reporttables_userid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="reporttableid" class="org.hisp.dhis.reporttable.ReportTable" />
+      <many-to-many column="reporttableid" class="org.hisp.dhis.reporttable.ReportTable" foreign-key="fk_dashboardcontent_reporttableid" />
     </list>
 
     <list name="mapViews" table="dashboardcontent_mapviews">
-      <key column="userid" />
+      <key column="userid" foreign-key="fk_dashboardcontent_mapviews_userid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="mapviewid" class="org.hisp.dhis.mapping.MapView" />
+      <many-to-many column="mapviewid" class="org.hisp.dhis.mapping.MapView" foreign-key="fk_dashboardcontent_mapviews_mapviewid" />
     </list>
 
   </class>

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2011-04-24 12:17:55 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2011-05-02 14:48:05 +0000
@@ -20,23 +20,23 @@
 
     <list name="dataElements" table="reporttable_dataelements">
       <cache usage="read-write" />
-      <key column="reporttableid" />
+      <key column="reporttableid" foreign-key="fk_reporttable_dataelements_reporttableid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="dataelementid" class="org.hisp.dhis.dataelement.DataElement" />
+      <many-to-many column="dataelementid" class="org.hisp.dhis.dataelement.DataElement" foreign-key="fk_reporttable_dataelements_dataelementid" />
     </list>
 
     <list name="indicators" table="reporttable_indicators">
       <cache usage="read-write" />
-      <key column="reporttableid" />
+      <key column="reporttableid" foreign-key="fk_reporttable_indicators_reporttableid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="indicatorid" class="org.hisp.dhis.indicator.Indicator" />
+      <many-to-many column="indicatorid" class="org.hisp.dhis.indicator.Indicator" foreign-key="fk_reporttable_indicators_indicatorid" />
     </list>
 
     <list name="dataSets" table="reporttable_datasets">
       <cache usage="read-write" />
-      <key column="reporttableid" />
+      <key column="reporttableid" foreign-key="fk_reporttable_datasets_reporttableid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="datasetid" class="org.hisp.dhis.dataset.DataSet" />
+      <many-to-many column="datasetid" class="org.hisp.dhis.dataset.DataSet" foreign-key="fk_reporttable_datasets_datasetid" />
     </list>
 
     <many-to-one name="categoryCombo" class="org.hisp.dhis.dataelement.DataElementCategoryCombo" column="categorycomboid"
@@ -44,16 +44,16 @@
 
     <list name="periods" table="reporttable_periods">
       <cache usage="read-write" />
-      <key column="reporttableid" />
+      <key column="reporttableid" foreign-key="fk_reporttable_periods_reporttableid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="periodid" class="org.hisp.dhis.period.Period" />
+      <many-to-many column="periodid" class="org.hisp.dhis.period.Period" foreign-key="fk_reporttable_periods_periodid" />
     </list>
 
     <list name="units" table="reporttable_organisationunits">
       <cache usage="read-write" />
-      <key column="reporttableid" />
+      <key column="reporttableid" foreign-key="fk_reporttable_organisationunits_reporttableid" />
       <list-index column="sort_order" base="0" />
-      <many-to-many column="organisationunitid" class="org.hisp.dhis.organisationunit.OrganisationUnit" />
+      <many-to-many column="organisationunitid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_reporttable_organisationunits_organisationunitid" />
     </list>
 
     <property name="doIndicators" />