Hibernate version:
3.0.5
mapping documents:
<hibernate-mapping>
<class name="cl.ABC.coreafp.pension.request.beans.RequestBean"
table="s_request">
<id name="requestId" column="REQ_REQ_SUR_ID" type="int">
<generator class="sequence">
<param name="sequence">s_request_seq</param>
</generator>
</id>
<property name="requestReceivedMode" column="REQ_RCD_MOD_CR"
type="java.lang.StrABC" />
<property name="officeNumber" column="REQ_RCD_OFN_NN"
type="int" />
<property name="officeDate" column="REQ_RCD_OFD_FC"
type="java.util.Date" />
<property name="countryOfAgreement" column="CC_COD_CR"
type="java.lang.StrABC" />
<property name="requestFromAfp" column="REQ_OTR_AFP_CR"
type="java.lang.StrABC" />
<property name="requestReceivedDate" column="REQ_RCD_DTE_FC"
type="java.util.Date" />
<property name="requestStatus" column="REQ_STA_CR"
type="java.lang.StrABC" />
<property name="ABCStaffId" column="EI_EID_ID" type="int" />
<property name="affiliateId" column="AFF_AFF_ID" type="int" />
<property name="branchCode" column="AB_COD_CR" type="java.lang.StrABC" />
<joined-subclass
name="cl.ABC.coreafp.pension.request.beans.PensionRequestBean"
table="s_pnsn_rqst">
<key column="REQ_REQ_SUR_ID" />
<property name="pensionStartDate" type="java.util.Date"
column="PRQ_PEN_STR_FC" length="50">
</property>
<property name="surplusRequestInd" column="PRQ_FUS_IND_RE"
type="short" />
<property name="pensionType" column="PRQ_STR_TYP_CR"
type="java.lang.StrABC" />
<property name="penReqAcptDate" column="PRQ_ACP_DTE_FC"
type="java.util.Date" />
<property name="sinisterDate" column="PRQ_STR_DTE_FC"
type="java.util.Date" />
<property name="sharePublicInformationInd"
column="PRQ_PUB_IND_RE" type="short" not-null="true" />
<property name="agrdDpstInOthrAPVInd" type="short"
column="PRQ_AGD_IND_RE" length="50">
</property>
<property name="disabilityPensionInd"
column="PRQ_DSP_IND_RE" type="short" />
<property name="disabilityPensionFromAfp"
column="PRQ_DSP_AFP_CR" type="java.lang.StrABC" />
<property name="govermentEmployeeIndicator"
column="PRQ_GVT_IND_RE" type="short" />
<property name="communicationMean" column="PRQ_COM_MNS_CR"
type="java.lang.StrABC" />
<property name="thirdPartyRequest" column="PRQ_RSD_BY_CR"
type="java.lang.StrABC" />
<property name="amtInAPVUsageInd" column="PRQ_APV_IND_RE"
type="short" />
<property name="contributedInOtherCountryInd"
column="PRQ_OCC_RE" type="short" />
<property name="contrLstTenYrsInd" column="PRQ_OSC_RE"
type="short" />
<property name="pensionerOldSystmInd" column="PRQ_OSP_RE"
type="short" />
<property name="pensionInOtherCountryInd"
column="PRQ_OCP_RE" type="short" />
<property name="affiliateId" column="AFF_AFF_ID"
type="int" />
<one-to-one name="objBalanceCertificateBean"
class="cl.ABC.coreafp.pension.BalanceCertificate.beans.BalanceCertificateBean" property-ref="requestId" fetch="select" constrained="true" lazy="proxy" outer-join="false"/>
<joined-subclass
name="cl.ABC.coreafp.pension.request.beans.NormalPensionRequestBean"
table="S_NORML_PNSN_RQST">
<key column="REQ_REQ_SUR_ID" />
<property name="accrualDateOption"
column="NPR_ACD_OPT_CR" type="java.lang.StrABC" />
<property name="preliminaryPaymentInd"
column="NPR_PRL_IND_RE" type="short" />
<property name="accrualDate" column="NPR_ACC_DTE_FC"
type="java.util.Date" />
<property name="volSvngUsageInd" column="NPR_VUS_IND_RE"
type="short" />
<property name="volSvngAmntInPesos"
column="NPR_VSP_AMT_$$" type="java.lang.Float" />
<property name="fundType1OfAccount2"
column="NPR_FTO_ACT_CR" type="char" />
<property name="fundType2OfAccount2"
column="NPR_FTT_ACT_CR" type="char" />
<property name="volSvngQuotesAmntInFund1"
column="NPR_VSA_FNO_$$" type="float" />
<property name="volSvngQuotesAmntInFund2"
column="NPR_VSA_FNT_$$" type="float" />
<property name="volConUsageInd" type="short"
column="NPR_VQI_IND_RE">
</property>
<property name="volConAmntInPesos"
column="NPR_VQP_AMT_$$" type="java.lang.Float" />
<property name="fundType1OfAccount4"
column="NPR_FTO_ACF_CR" type="char" />
<property name="fundType2OfAccount4"
column="NPR_FTT_ACF_CR" type="char" />
<property name="volConQuotesAmntInFund1"
column="NPR_VCA_FTO_$$" type="float" />
<property name="volConQuotesAmntInFund2"
column="NPR_VCA_FTT_$$" type="float" />
<property name="adjustToMinimumPensionInd"
column="NPR_MNP_IND_RE" type="short" />
<property name="APVTransactionid" column="NPR_AID_ID"
type="int" />
<property name="voluntarySocialSecurityTransactionId"
column="NPR_VID_ID" type="int" />
</joined-subclass>
</joined-subclass>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Criteria criteria = session.createCriteria(RequestBean.class);
criteria.add(Expression.eq("affiliateId", new Integer(objPensionRequestViewBean.getAffiliateId())));
if (!objPensionRequestViewBean.getAgency().equals("0")) {
criteria.add(Expression.eq("branchCode", objPensionRequestViewBean
.getAgency()));
}
if (!objPensionRequestViewBean.getStatus().equals("0")) {
criteria.add(Expression.eq("requestStatus", objPensionRequestViewBean
.getStatus()));
}
if (!objPensionRequestViewBean.getRequestType().equals("0")) {
criteria.add(Expression.eq("pensionType", objPensionRequestViewBean
.getRequestType()));
}
if (objPensionRequestViewBean.getFromDate() != null) {
criteria.add(Expression.ge("requestReceivedDate",
objPensionRequestViewBean.getFromDate()));
}
if (objPensionRequestViewBean.getToDate() != null) {
criteria.add(Expression.le("requestReceivedDate",
objPensionRequestViewBean.getToDate()));
}
List pensionRequestList = new HibernatePaginationUtility().getPage(criteria,objPensionRequestViewBean.getIntPageNumber(),iPageSize);
objPensionRequestViewBean.setPensionRequestList(pensionRequestList);
Full stack trace of any exception that occurs:
No exception
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
Hibernate: select * from ( select this_.REQ_REQ_SUR_ID as REQ1_0_, this_.REQ_RCD_MOD_CR as REQ2_0_0_, this_.REQ_RCD_OFN_NN as REQ3_0_0_, this_.REQ_RCD_OFD_FC as REQ4_0_0_, this_.CC_COD_CR as CC5_0_0_, this_.REQ_OTR_AFP_CR as REQ6_0_0_, this_.REQ_RCD_DTE_FC as REQ7_0_0_, this_.REQ_STA_CR as REQ8_0_0_, this_.EI_EID_ID as EI9_0_0_, this_.AFF_AFF_ID as AFF10_0_0_, this_.AB_COD_CR as AB11_0_0_, this_1_.PRQ_PEN_STR_FC as PRQ2_1_0_, this_1_.PRQ_FUS_IND_RE as PRQ3_1_0_, this_1_.PRQ_STR_TYP_CR as PRQ4_1_0_, this_1_.PRQ_ACP_DTE_FC as PRQ5_1_0_, this_1_.PRQ_STR_DTE_FC as PRQ6_1_0_, this_1_.PRQ_PUB_IND_RE as PRQ7_1_0_, this_1_.PRQ_AGD_IND_RE as PRQ8_1_0_, this_1_.PRQ_DSP_IND_RE as PRQ9_1_0_, this_1_.PRQ_DSP_AFP_CR as PRQ10_1_0_, this_1_.PRQ_GVT_IND_RE as PRQ11_1_0_, this_1_.PRQ_COM_MNS_CR as PRQ12_1_0_, this_1_.PRQ_RSD_BY_CR as PRQ13_1_0_, this_1_.PRQ_APV_IND_RE as PRQ14_1_0_, this_1_.PRQ_OCC_RE as PRQ15_1_0_, this_1_.PRQ_OSC_RE as PRQ16_1_0_, this_1_.PRQ_OSP_RE as PRQ17_1_0_, this_1_.PRQ_OCP_RE as PRQ18_1_0_, this_1_.AFF_AFF_ID as AFF19_1_0_, this_2_.NPR_ACD_OPT_CR as NPR2_2_0_, this_2_.NPR_PRL_IND_RE as NPR3_2_0_, this_2_.NPR_ACC_DTE_FC as NPR4_2_0_, this_2_.NPR_VUS_IND_RE as NPR5_2_0_, this_2_.NPR_VSP_AMT_$$ as NPR6_2_0_, this_2_.NPR_FTO_ACT_CR as NPR7_2_0_, this_2_.NPR_FTT_ACT_CR as NPR8_2_0_, this_2_.NPR_VSA_FNO_$$ as NPR9_2_0_, this_2_.NPR_VSA_FNT_$$ as NPR10_2_0_, this_2_.NPR_VQI_IND_RE as NPR11_2_0_, this_2_.NPR_VQP_AMT_$$ as NPR12_2_0_, this_2_.NPR_FTO_ACF_CR as NPR13_2_0_, this_2_.NPR_FTT_ACF_CR as NPR14_2_0_, this_2_.NPR_VCA_FTO_$$ as NPR15_2_0_, this_2_.NPR_VCA_FTT_$$ as NPR16_2_0_, this_2_.NPR_MNP_IND_RE as NPR17_2_0_, this_2_.NPR_AID_ID as NPR18_2_0_, this_2_.NPR_VID_ID as NPR19_2_0_, case when this_2_.REQ_REQ_SUR_ID is not null then 2 when this_1_.REQ_REQ_SUR_ID is not null then 1 when this_.REQ_REQ_SUR_ID is not null then 0 end as clazz_0_ from s_request this_ left outer join s_pnsn_rqst this_1_ on this_.REQ_REQ_SUR_ID=this_1_.REQ_REQ_SUR_ID left outer join S_NORML_PNSN_RQST this_2_ on this_.REQ_REQ_SUR_ID=this_2_.REQ_REQ_SUR_ID where this_.AFF_AFF_ID=? ) where rownum <= ?
Hibernate: select balancecer0_.BCC_BCC_SUR_ID as BCC1_0_, balancecer0_.BCC_STA_CR as BCC2_6_0_, balancecer0_.BCC_ISS_DTE_FC as BCC3_6_0_, balancecer0_.BCC_EXP_DTE_FC as BCC4_6_0_, balancecer0_.BCC_CLO_DTE_FC as BCC5_6_0_, balancecer0_.REQ_REQ_SUR_ID as REQ6_6_0_, balancecer0_.BCC_DEV_DTE_FC as BCC7_6_0_, balancecer0_.BCC_FOL_NN as BCC8_6_0_, balancecer0_.BCC_CRT_ID as BCC9_6_0_, balancecer0_.BCC_CRT_FC as BCC10_6_0_, balancecer0_.BCC_LST_UPD_ID as BCC11_6_0_, balancecer0_.BCC_LST_UPD_FC as BCC12_6_0_ from s_balance_cert balancecer0_ where balancecer0_.REQ_REQ_SUR_ID=?
Debug level Hibernate log excerpt:
Question:
Expected result is to do a fetch on s_request and its subclasses and NOT to fetch from the associated class (one-to-one correspondent) objBalanceCertificateBean. Ref to the attribs --> constrained="true" lazy="proxy" outer-join="false". How could we ensure that the second query on BalanceCertificate is not fired? Pls help.
_________________ Today is the Tomorrow that you were worried about Yesterday.
|