The biggest problem i'd like to solve is that the codeset associations are not lazy loading, a mapping for providers for example:
Code:
<hibernate-mapping>
<class name="Provider" table="PROV" schema="PROV">
<cache usage="read-write"/>
<id name="providerKey" type="java.lang.Integer">
<column name="PROV_KEY" />
<generator class="assigned" />
</id>
<property name="effectiveDate" type="java.util.Date">
<column name="EFF_DATE" length="10" />
</property>
<property name="doingBusinessAsName" type="java.lang.String">
<column name="DNGBSNSAS_NAME" length="100" />
</property>
<property name="facilityIndicator" type="java.lang.Integer">
<column name="FAC_IND" />
</property>
<property name="legalName" type="java.lang.String">
<column name="LGL_NAME" length="100" />
</property>
<many-to-one lazy="false" fetch="join" name="providerClassificationCodeset" property-ref="providerCodeset">
<column name="PROV_CLS_CODE" length="5"/>
<formula>'00003'</formula>
</many-to-one>
<many-to-one lazy="false" fetch="join" name="providerStatusCodeset" property-ref="providerCodeset">
<column name="PROV_STS_CODE" length="5"/>
<formula>'00001'</formula>
</many-to-one>
<many-to-one lazy="false" fetch="join" name="providerTypeCodeset" property-ref="providerCodeset">
<column name="PROV_TYPE_CODE" length="5"/>
<formula>'00002'</formula>
</many-to-one>
<set name="practitioners" inverse="true">
<key>
<column name="PROV_KEY" />
</key>
<one-to-many class="Practitioner" />
</set>
</class>
</hibernate-mapping>
If i do a select to get all the providers (there are about 4000 of them), it does a select statement to get the list of providers:
Code:
select
provider0_.PROV_KEY as PROV1_44_,
provider0_.EFF_DATE as EFF2_44_,
provider0_.DNGBSNSAS_NAME as DNGBSNSAS3_44_,
provider0_.FAC_IND as FAC4_44_,
provider0_.LGL_NAME as LGL5_44_,
provider0_.PROV_CLS_CODE as PROV6_44_,
provider0_.PROV_STS_CODE as PROV7_44_,
provider0_.PROV_TYPE_CODE as PROV8_44_,
'00003' as formula0_,
'00001' as formula1_,
'00002' as formula2_
from
PROV.PROV provider0_
followed by 12,000 select statements to get 3 ProviderCodesets for each provider (3*n):
Code:
select
providerco0_.PROV_CS_KEY as PROV1_45_0_,
providerco0_.PROV_CS_CODE as PROV2_45_0_,
providerco0_.PROV_CS_TYPE_CODE as PROV3_45_0_,
providerco0_.SRC_APPL_CODE as SRC4_45_0_,
providerco0_.ACTV_IND as ACTV5_45_0_,
providerco0_.SORT_ORDR_NBR as SORT6_45_0_,
providerco0_.PROV_CMN_CS_CODE as PROV7_45_0_,
providerco0_.PROV_CS_NAME as PROV8_45_0_,
providerco0_.PROV_CS_DESC as PROV9_45_0_
from
PROV.PROV_CS providerco0_
where
providerco0_.PROV_CS_CODE=?
and providerco0_.PROV_CS_TYPE_CODE=?
As bad as this is, the bigger problem is that every single table in the database (around 80 tables) have associations for ProviderCodesets in them.
So my biggest problem is, why arent these associations lazy loading? Reguardless of what i set lazy to, {proxy,no-proxy,false}, they never lazy load. How can i change this so it doesnt load every single association when getting the list? thanks.