dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40526
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20565: TEI query. Removing lazy=false for attributeValues in hibernate mapping. Using eager fetching wit...
------------------------------------------------------------
revno: 20565
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-10-07 15:22:46 +0200
message:
TEI query. Removing lazy=false for attributeValues in hibernate mapping. Using eager fetching with join in HQL query to avoid n queries per attribute per TEI.
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.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-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2015-09-24 08:32:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2015-10-07 13:22:46 +0000
@@ -121,7 +121,7 @@
private String buildTrackedEntityInstanceHql( TrackedEntityInstanceQueryParams params )
{
- String hql = "from TrackedEntityInstance tei";
+ String hql = "from TrackedEntityInstance tei inner join fetch tei.attributeValues";
SqlHelper hlp = new SqlHelper( true );
if ( params.hasTrackedEntity() )
=== 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-08-25 21:48:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.hbm.xml 2015-10-07 13:22:46 +0000
@@ -14,7 +14,7 @@
<property name="inactive" column="inactive" />
- <set name="attributeValues" inverse="true" lazy="false">
+ <set name="attributeValues" inverse="true">
<key column="trackedentityinstanceid" />
<one-to-many class="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue" />
</set>