dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38606
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19665: In AbstractTEIService, use TEI.attributeValues (lazy=false) instead of TEAService.getAttributeVal...
------------------------------------------------------------
revno: 19665
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-07-16 12:20:56 +0700
message:
In AbstractTEIService, use TEI.attributeValues (lazy=false) instead of TEAService.getAttributeValues(..), speeds up TEI queries by about 40%
modified:
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.hbm.xml
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.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/trackedentity/hibernate/TrackedEntityInstance.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.hbm.xml 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.hbm.xml 2015-07-16 05:20:56 +0000
@@ -12,7 +12,7 @@
</id>
&identifiableProperties;
- <set name="attributeValues" inverse="true">
+ <set name="attributeValues" inverse="true" lazy="false">
<key column="trackedentityinstanceid" />
<one-to-many class="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue" />
</set>
@@ -23,13 +23,13 @@
</set>
<many-to-one name="representative" class="org.hisp.dhis.trackedentity.TrackedEntityInstance" column="representativeid"
- foreign-key="fk_trackedentityinstance_representativeid" />
+ foreign-key="fk_trackedentityinstance_representativeid" lazy="false" />
<many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid"
- foreign-key="fk_trackedentityinstance_organisationunitid" not-null="true" />
+ foreign-key="fk_trackedentityinstance_organisationunitid" not-null="true" lazy="false" />
<many-to-one name="trackedEntity" class="org.hisp.dhis.trackedentity.TrackedEntity"
- column="trackedentityid" foreign-key="fk_trackedentityinstance_trackedentityid" />
+ column="trackedentityid" foreign-key="fk_trackedentityinstance_trackedentityid" lazy="false" />
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java 2015-07-03 07:33:54 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java 2015-07-16 05:20:56 +0000
@@ -174,10 +174,7 @@
trackedEntityInstance.getRelationships().add( relationship );
}
- Collection<TrackedEntityAttributeValue> attributeValues = attributeValueService
- .getTrackedEntityAttributeValues( entityInstance );
-
- for ( TrackedEntityAttributeValue attributeValue : attributeValues )
+ for ( TrackedEntityAttributeValue attributeValue : entityInstance.getAttributeValues() )
{
Attribute attribute = new Attribute();