ItEr59S22MellorasGlobalesRendemento: Adding indexes over foreign keys in certain associations of several hbm.xml files.
The reviewed hbm.xml files are: Advance.hbm.xml Calendars.hbm.xml Configuration.hbm.xml ExternalCompanies.hbm.xml AdvanceConsolidations.hbm.xml Tasks.hbm.xml QualityForms.hbm.xml Users.hbm.xml WorkReports.hbm.xml
This commit is contained in:
parent
c1b7a8bf85
commit
daa48353e3
9 changed files with 133 additions and 11 deletions
|
|
@ -56,6 +56,7 @@
|
|||
<one-to-many class="org.navalplanner.business.advance.entities.AdvanceMeasurement"></one-to-many>
|
||||
</set>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="nonCalculatedConsolidations"
|
||||
cascade="none"
|
||||
inverse="true"
|
||||
|
|
@ -75,6 +76,7 @@
|
|||
column="INDIRECT_ORDER_ELEMENT_ID"
|
||||
index="idx_indirectadvanceassigment_on_orderelement"/>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="calculatedConsolidations"
|
||||
cascade="none"
|
||||
inverse="true"
|
||||
|
|
@ -101,6 +103,7 @@
|
|||
<many-to-one name="advanceAssignment" class="AdvanceAssignment" column="ADVANCE_ASSIGNMENT_ID" access="field" />
|
||||
<property name="communicationDate" access="field" />
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="nonCalculatedConsolidatedValues" access="field" cascade="none" inverse="true">
|
||||
<key column="ADVANCE_MEASUREMENT_ID" />
|
||||
<one-to-many class="org.navalplanner.business.planner.entities.consolidations.NonCalculatedConsolidatedValue" />
|
||||
|
|
|
|||
|
|
@ -16,17 +16,20 @@
|
|||
|
||||
<property name="name" access="field"/>
|
||||
|
||||
<!-- Index created in a database-object section -->
|
||||
<set name="exceptions" access="field" cascade="all-delete-orphan">
|
||||
<key column="BASE_CALENDAR_ID" />
|
||||
<one-to-many class="CalendarException" />
|
||||
</set>
|
||||
|
||||
<!-- Index on the other side -->
|
||||
<list name="calendarDataVersions" access="field" cascade="all-delete-orphan">
|
||||
<key column="BASE_CALENDAR_ID" />
|
||||
<index column="POSITION_IN_CALENDAR" />
|
||||
<one-to-many class="CalendarData" />
|
||||
</list>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<list name="calendarAvailabilities" access="field" cascade="all-delete-orphan">
|
||||
<key column="BASE_CALENDAR_ID" />
|
||||
<index column="POSITION_IN_CALENDAR" />
|
||||
|
|
@ -56,6 +59,7 @@
|
|||
<property name="date" access="field"
|
||||
type="org.joda.time.contrib.hibernate.PersistentLocalDate"/>
|
||||
<property name="hours" access="field"/>
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="type" cascade="none"
|
||||
column="CALENDAR_EXCEPTION_ID" />
|
||||
|
||||
|
|
@ -95,7 +99,9 @@
|
|||
<element column="HOURS" type="integer" />
|
||||
</map>
|
||||
|
||||
<many-to-one name="parent" class="BaseCalendar" access="field"/>
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="parent" class="BaseCalendar" access="field"
|
||||
index="idx_CalendarData_on_BaseCalendar" />
|
||||
|
||||
<property name="expiringDate" access="field"
|
||||
type="org.joda.time.contrib.hibernate.PersistentLocalDate"/>
|
||||
|
|
@ -117,4 +123,11 @@
|
|||
|
||||
</class>
|
||||
|
||||
<!-- Index to boost the search of CalendarExceptions inside BaseCalendar -->
|
||||
<database-object>
|
||||
<create>CREATE INDEX idx_CalendarException_on_BaseCalendar ON CalendarException (BASE_CALENDAR_ID)</create>
|
||||
<drop>DROP INDEX idx_CalendarException_on_BaseCalendar</drop>
|
||||
<dialect-scope name="org.hibernate.dialect.PostgreSQLDialect" />
|
||||
<dialect-scope name="org.hibernate.dialect.MySQLInnoDBDialect" />
|
||||
</database-object>
|
||||
</hibernate-mapping>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="defaultCalendar" cascade="none"
|
||||
column="CONFIGURATION_ID" />
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
<property name="ourCompanyPassword" />
|
||||
|
||||
<!-- Not indexed, navigation from User to this is not even implemented -->
|
||||
<many-to-one name="companyUser" class="org.navalplanner.business.users.entities.User" />
|
||||
</class>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,19 @@
|
|||
<property name="taskEndDate" access="field" type="org.joda.time.contrib.hibernate.PersistentLocalDate" />
|
||||
|
||||
<subclass name="NonCalculatedConsolidatedValue" discriminator-value="NonCalculated">
|
||||
<many-to-one name="consolidation" class="NonCalculatedConsolidation" column="CONSOLIDATION_ID" access="field" />
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="consolidation" class="NonCalculatedConsolidation"
|
||||
column="CONSOLIDATION_ID" access="field"
|
||||
index="idx_NonCalculatedConsolidatedValue_on_NonCalculatedConsolidation" />
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="advanceMeasurement" class="org.navalplanner.business.advance.entities.AdvanceMeasurement" column="ADVANCE_MEASUREMENT_ID" access="field" />
|
||||
</subclass>
|
||||
|
||||
<subclass name="CalculatedConsolidatedValue" discriminator-value="Calculated">
|
||||
<many-to-one name="consolidation" class="CalculatedConsolidation" column="CONSOLIDATION_ID" access="field" />
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="consolidation" class="CalculatedConsolidation"
|
||||
column="CONSOLIDATION_ID" access="field"
|
||||
index="idx_CalculatedConsolidatedValue_on_CalculatedConsolidation" />
|
||||
</subclass>
|
||||
|
||||
</class>
|
||||
|
|
@ -39,9 +46,11 @@
|
|||
|
||||
<subclass name="NonCalculatedConsolidation" discriminator-value="NonCalculated">
|
||||
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="directAdvanceAssignment" column="DIR_ADVANCE_ASSIGNMENT_ID" access="field"
|
||||
class="org.navalplanner.business.advance.entities.DirectAdvanceAssignment" />
|
||||
|
||||
<!-- Indexed on the other side -->
|
||||
<set name="consolidatedValues"
|
||||
access="field"
|
||||
cascade="all,delete-orphan"
|
||||
|
|
@ -55,9 +64,11 @@
|
|||
|
||||
<subclass name="CalculatedConsolidation" discriminator-value="Calculated">
|
||||
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="indirectAdvanceAssignment" column="IND_ADVANCE_ASSIGNMENT_ID" access="field"
|
||||
class="org.navalplanner.business.advance.entities.IndirectAdvanceAssignment"/>
|
||||
|
||||
<!-- Indexed on the other side -->
|
||||
<set name="consolidatedValues"
|
||||
access="field"
|
||||
cascade="all,delete-orphan"
|
||||
|
|
|
|||
|
|
@ -16,20 +16,25 @@
|
|||
<property name="deadline" type="org.joda.time.contrib.hibernate.PersistentLocalDate" />
|
||||
<property name="advancePercentage" column="ADVANCE_PERCENTAGE" />
|
||||
|
||||
<many-to-one name="parent" class="TaskGroup" cascade="none" column="parent"/>
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="parent" class="TaskGroup" cascade="none" column="parent"
|
||||
index="idx_TaskElement_on_TaskGroup" />
|
||||
|
||||
<one-to-one name="taskSource" cascade="none"/>
|
||||
|
||||
<!-- Indexed on the other side -->
|
||||
<set name="dependenciesWithThisOrigin" cascade="all-delete-orphan">
|
||||
<key column="ORIGIN"></key>
|
||||
<one-to-many class="Dependency" />
|
||||
</set>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="dependenciesWithThisDestination" cascade="all-delete-orphan">
|
||||
<key column="DESTINATION"></key>
|
||||
<one-to-many class="Dependency" />
|
||||
</set>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="calendar" column="BASE_CALENDAR_ID" cascade="none"
|
||||
class="org.navalplanner.business.calendars.entities.BaseCalendar"/>
|
||||
|
||||
|
|
@ -52,11 +57,13 @@
|
|||
<one-to-one name="consolidation" class="org.navalplanner.business.planner.entities.consolidations.Consolidation"
|
||||
cascade="all"/>
|
||||
|
||||
<!-- Indexed on the other side -->
|
||||
<set name="resourceAllocations" cascade="all-delete-orphan">
|
||||
<key column="TASK" />
|
||||
<one-to-many class="ResourceAllocation" />
|
||||
</set>
|
||||
|
||||
<!-- Already indexed because it's unique -->
|
||||
<many-to-one name="subcontractedTaskData"
|
||||
column="SUBCONTRATED_TASK_DATA_ID"
|
||||
unique="true" cascade="all" lazy="false" />
|
||||
|
|
@ -67,6 +74,8 @@
|
|||
|
||||
<joined-subclass name="TaskGroup">
|
||||
<key column="TASK_ELEMENT_ID"></key>
|
||||
|
||||
<!-- Indexed on the other side -->
|
||||
<list name="taskElements" cascade="all">
|
||||
<key column="parent" not-null="false"></key>
|
||||
<index column="positionInParent"></index>
|
||||
|
|
@ -84,10 +93,17 @@
|
|||
<generator class="hilo"></generator>
|
||||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<!-- Indexed -->
|
||||
<many-to-one class="TaskElement" name="origin"
|
||||
column="ORIGIN" />
|
||||
column="ORIGIN"
|
||||
index="idx_Dependency_on_TaskElement_origin" />
|
||||
|
||||
<!-- Not indexed, navigation in that direction is not useful -->
|
||||
<many-to-one class="TaskElement" name="destination"
|
||||
column="DESTINATION" />
|
||||
|
||||
<!-- Not indexed, relation from the other side is one-to-one -->
|
||||
<many-to-one class="org.navalplanner.business.planner.limiting.entities.LimitingResourceQueueDependency"
|
||||
cascade="all"
|
||||
name="queueDependency"
|
||||
|
|
@ -109,6 +125,7 @@
|
|||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<!-- Not indexed, navigation from ExternalCompany to this is not even implemented -->
|
||||
<many-to-one name="externalCompany" class="org.navalplanner.business.externalcompanies.entities.ExternalCompany" />
|
||||
|
||||
<one-to-one name="task" class="Task"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
</type>
|
||||
</property>
|
||||
|
||||
<!-- Index created in a database-object section -->
|
||||
<list name="qualityFormItems" table="QUALITY_FORM_ITEMS">
|
||||
<key column="QUALITY_FORM_ID"/>
|
||||
<index column="idx"/>
|
||||
|
|
@ -54,6 +55,7 @@
|
|||
column="ORDER_ELEMENT_ID"
|
||||
index="idx_taskqualityform_on_orderelement"/>
|
||||
|
||||
<!-- Index created in a database-object section -->
|
||||
<list name="taskQualityFormItems" table="TASK_QUALITY_FORM_ITEMS">
|
||||
<key column="TASK_QUALITY_FORM_ID"/>
|
||||
<index column="idx"/>
|
||||
|
|
@ -70,4 +72,22 @@
|
|||
|
||||
</class>
|
||||
|
||||
<!-- Index to boost the search of QualityFormItems inside a QualityForm -->
|
||||
<database-object>
|
||||
<create>CREATE INDEX idx_QualityForm_on_QualityFormItems
|
||||
ON QUALITY_FORM_ITEMS (QUALITY_FORM_ID)</create>
|
||||
<drop>DROP INDEX idx_QualityForm_on_QualityFormItems</drop>
|
||||
<dialect-scope name="org.hibernate.dialect.PostgreSQLDialect" />
|
||||
<dialect-scope name="org.hibernate.dialect.MySQLInnoDBDialect" />
|
||||
</database-object>
|
||||
|
||||
<!-- Index to boost the search of TaskQualityFormItems inside a TaskQualityForm -->
|
||||
<database-object>
|
||||
<create>CREATE INDEX idx_TaskQualityForm_on_TaskQualityFormItems
|
||||
ON TASK_QUALITY_FORM_ITEMS (TASK_QUALITY_FORM_ID)</create>
|
||||
<drop>DROP INDEX idx_TaskQualityForm_on_TaskQualityFormItems</drop>
|
||||
<dialect-scope name="org.hibernate.dialect.PostgreSQLDialect" />
|
||||
<dialect-scope name="org.hibernate.dialect.MySQLInnoDBDialect" />
|
||||
</database-object>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
<property name="password" not-null="true"/>
|
||||
<property name="email"/>
|
||||
<property name="disabled"/>
|
||||
|
||||
<!-- Index created in a database-object section -->
|
||||
<set name="roles" table="USER_ROLES">
|
||||
<key column="userId"/>
|
||||
<element>
|
||||
|
|
@ -33,6 +35,8 @@
|
|||
</type>
|
||||
</element>
|
||||
</set>
|
||||
|
||||
<!-- Index created in a database-object section -->
|
||||
<set name="profiles" table="USER_PROFILES">
|
||||
<key column="USER_ID"/>
|
||||
<many-to-many column="PROFILE_ID"
|
||||
|
|
@ -50,6 +54,7 @@
|
|||
|
||||
<property name="profileName" not-null="true" unique="true"/>
|
||||
|
||||
<!-- Index created in a database-object section -->
|
||||
<set name="roles" table="PROFILE_ROLES">
|
||||
<key column="profileId"/>
|
||||
<element>
|
||||
|
|
@ -93,4 +98,28 @@
|
|||
|
||||
</class>
|
||||
|
||||
<!-- Index to boost the search of roles inside users -->
|
||||
<database-object>
|
||||
<create>CREATE INDEX idx_User_on_UserRoles ON USER_ROLES (userId)</create>
|
||||
<drop>DROP INDEX idx_User_on_UserRoles</drop>
|
||||
<dialect-scope name="org.hibernate.dialect.PostgreSQLDialect" />
|
||||
<dialect-scope name="org.hibernate.dialect.MySQLInnoDBDialect" />
|
||||
</database-object>
|
||||
|
||||
<!-- Index to boost the search of roles inside profiles -->
|
||||
<database-object>
|
||||
<create>CREATE INDEX idx_Profile_on_ProfileRoles ON PROFILE_ROLES (profileId)</create>
|
||||
<drop>DROP INDEX idx_Profile_on_ProfileRoles</drop>
|
||||
<dialect-scope name="org.hibernate.dialect.PostgreSQLDialect" />
|
||||
<dialect-scope name="org.hibernate.dialect.MySQLInnoDBDialect" />
|
||||
</database-object>
|
||||
|
||||
<!-- Index to boost the search of profiles inside users -->
|
||||
<database-object>
|
||||
<create>CREATE INDEX idx_User_on_UserProfiles ON USER_PROFILES (USER_ID)</create>
|
||||
<drop>DROP INDEX idx_User_on_UserProfiles</drop>
|
||||
<dialect-scope name="org.hibernate.dialect.PostgreSQLDialect" />
|
||||
<dialect-scope name="org.hibernate.dialect.MySQLInnoDBDialect" />
|
||||
</database-object>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
|
|
|||
|
|
@ -23,11 +23,13 @@
|
|||
</type>
|
||||
</property>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="workReportLabelTypeAssigments" cascade="all-delete-orphan">
|
||||
<key column="WORK_REPORT_TYPE_ID"/>
|
||||
<one-to-many class="WorkReportLabelTypeAssigment"/>
|
||||
</set>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="headingFields" table="HEADING_FIELD">
|
||||
<key column="HEADING_ID"/>
|
||||
<composite-element class="org.navalplanner.business.workreports.valueobjects.DescriptionField">
|
||||
|
|
@ -37,6 +39,7 @@
|
|||
</composite-element>
|
||||
</set>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="lineFields" table="LINE_FIELD">
|
||||
<key column="HEADING_ID"/>
|
||||
<composite-element class="org.navalplanner.business.workreports.valueobjects.DescriptionField">
|
||||
|
|
@ -63,23 +66,31 @@
|
|||
|
||||
<property name="generateCode" not-null="true" />
|
||||
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="workReportType" class="WorkReportType" column="WORK_REPORT_TYPE_ID" not-null="true"/>
|
||||
|
||||
<many-to-one name="resource" class="org.navalplanner.business.resources.entities.Resource" column="RESOURCE_ID"/>
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="resource" class="org.navalplanner.business.resources.entities.Resource" column="RESOURCE_ID"
|
||||
index="idx_Resource_on_WorkReport" />
|
||||
|
||||
<many-to-one name="orderElement" class="org.navalplanner.business.orders.entities.OrderElement" column="ORDER_ELEMENT_ID"/>
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="orderElement" class="org.navalplanner.business.orders.entities.OrderElement"
|
||||
column="ORDER_ELEMENT_ID" index="idx_OrderElement_on_WorkReport" />
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="labels" table="WORKREPORTS_LABELS">
|
||||
<key column="WORK_REPORT_ID"/>
|
||||
<many-to-many column="LABEL_ID"
|
||||
class="org.navalplanner.business.labels.entities.Label"/>
|
||||
</set>
|
||||
|
||||
<!-- Indexed on the other side -->
|
||||
<set name="workReportLines" cascade="all-delete-orphan" inverse="true">
|
||||
<key column="WORK_REPORT_ID"/>
|
||||
<one-to-many class="WorkReportLine"/>
|
||||
</set>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="descriptionValues" table="DESCRIPTION_VALUES">
|
||||
<key column="DESCRIPTION_VALUE_ID"/>
|
||||
<composite-element class="org.navalplanner.business.workreports.valueobjects.DescriptionValue">
|
||||
|
|
@ -107,20 +118,34 @@
|
|||
<property name="clockFinish" access="field"
|
||||
type="org.joda.time.contrib.hibernate.PersistentLocalTimeExact" />
|
||||
|
||||
<many-to-one name="workReport" class="org.navalplanner.business.workreports.entities.WorkReport" column="WORK_REPORT_ID" />
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="workReport" class="org.navalplanner.business.workreports.entities.WorkReport"
|
||||
column="WORK_REPORT_ID"
|
||||
index="idx_WorkReport_on_WorkReportLine" />
|
||||
|
||||
<many-to-one name="resource" class="org.navalplanner.business.resources.entities.Resource" column="RESOURCE_ID" not-null="true"/>
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="resource" class="org.navalplanner.business.resources.entities.Resource"
|
||||
column="RESOURCE_ID" not-null="true"
|
||||
index="idx_Resource_on_WorkReportLine" />
|
||||
|
||||
<many-to-one name="orderElement" class="org.navalplanner.business.orders.entities.OrderElement" column="ORDER_ELEMENT_ID" not-null="true"/>
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="orderElement" class="org.navalplanner.business.orders.entities.OrderElement"
|
||||
column="ORDER_ELEMENT_ID" not-null="true"
|
||||
index="idx_OrderElement_on_WorkReportLine" />
|
||||
|
||||
<many-to-one name="typeOfWorkHours" class="org.navalplanner.business.costcategories.entities.TypeOfWorkHours" column="TYPE_WORK_HOURS_ID" not-null="true"/>
|
||||
<!-- Indexed -->
|
||||
<many-to-one name="typeOfWorkHours" class="org.navalplanner.business.costcategories.entities.TypeOfWorkHours"
|
||||
column="TYPE_WORK_HOURS_ID" not-null="true"
|
||||
index="idx_TypeOfWorkHours_on_WorkReportLine" />
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="labels" table="WORKREPORTSLINES_LABELS">
|
||||
<key column="WORK_REPORT_LINE_ID"/>
|
||||
<many-to-many column="LABEL_ID"
|
||||
class="org.navalplanner.business.labels.entities.Label"/>
|
||||
</set>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<set name="descriptionValues" table="DESCRIPTION_VALUES_IN_LINE">
|
||||
<key column="DESCRIPTION_VALUE_ID"/>
|
||||
<composite-element class="org.navalplanner.business.workreports.valueobjects.DescriptionValue">
|
||||
|
|
@ -142,8 +167,10 @@
|
|||
<property name="labelsSharedByLines"/>
|
||||
<property name="positionNumber"/>
|
||||
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="labelType" class="org.navalplanner.business.labels.entities.LabelType" column="LABEL_TYPE_ID" />
|
||||
|
||||
<!-- Not indexed -->
|
||||
<many-to-one name="defaultLabel" class="org.navalplanner.business.labels.entities.Label" column="LABEL_ID" />
|
||||
|
||||
</class>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue