Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:Hibernate 3.0.5
DB : Oracle 9i
Mapping documents
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="cl.ing.coreafp.accounts.beans.RezAffiliateDetailsBean" table="T_QUOTATION_MSTR">
<id name="quotationid" column="QTM_QTN_ID" type="long">
</id>
<property name="affiliateRUT" column="QTM_AFF_RUT_ID" type="java.lang.String" />
<property name="rolloFolio" column="QTM_ROL_FOL_NN" type="long" />
<property name="imagenFolio" column="QTM_IMG_FOL_NN" type="long" />
<property name="seqNumber" column="QTM_SEQ_NN" type="long" />
<property name="quotationperiod" column="QTM_QTN_PRD_NN" type="long" />
<property name="paymentdate" column="QTM_PMT_FC" type="java.util.Date" />
<property name="affiliatename" column="QTM_AFF_NM" type="java.lang.String" />
<property name="payerrut" column="QTM_PYR_RUT_ID" type="java.lang.String" />
<property name="accountAssistantCode" column="QTM_ACC_ASS_CD" type="int" />
<property name="errorSeqNumber" column="EAD_ERR_AUT_NN" type="long" />
<set name="objQuotationAcctDetailsBean" cascade="all" lazy="true">
<key column="QTM_QTN_ID"/>
<one-to-many class="cl.ing.coreafp.accounts.beans.QuotationAcctDetailsBean" />
</set>
<one-to-one name="objErrorAuthBean" class="cl.ing.coreafp.accounts.beans.ErrorAuthBean" property-ref="quotationid"/>
</class>
</hibernate-mapping>
-----------------------
objErrorAuthBean
-------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="cl.ing.coreafp.accounts.beans.ErrorAuthBean" table="T_ERROR_AUTH_DTLS">
<id name="errorcode1" column="EAD_ERR_AUT_NN" type="long">
</id>
<property name="errorcode" column="ERM_ERR_ID" type="long" />
<property name="auxcode" column="AXM_AUX_ID" type="long" />
<property name="authorisationFlag" column="EAD_ATH_RE" type="short" />
<property name="authorisedDate" column="EAD_ATH_FC" type="java.util.Date" />
<property name="quotationid" column="QTM_QTN_ID" type="long" />
</class>
</hibernate-mapping>
--------------------------------------
QuotationAcctDetailsBean
---------------------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="cl.ing.coreafp.accounts.beans.QuotationAcctDetailsBean" table="T_QUOTATION_ACCT_DTLS">
<id name="quotationAccId" column="QAD_QTN_ACC_ID" type="long">
</id>
<property name="quotationId" column="QTM_QTN_ID" type="long" />
<property name="accountTypeId" column="ATM_ACC_TYP_ID" type="short" />
<property name="diffAddiQtn" column="QAD_DFF_ADQ_$$" type="float" />
<property name="diffInfQtn" column="QAD_DFF_QOT_$$" type="float" />
<property name="paymentTypeFlag" column="QAD_PMT_TYP_RE" type="short" />
<property name="informedAddiAmount" column="QAD_ADL_QOT_$$" type="float" />
<property name="informedAddiPenalty" column="QAD_ADL_PNP_$$" type="float" />
<property name="informedPenalty" column="QAD_PEN_QOT_$$" type="float" />
<property name="informedQuotationAmount" column="QAD_QTN_QOT_$$" type="float" />
</class>
</hibernate-mapping>
code between seeions is
Criteria criteriaCheque = session.createCriteria(RezAffiliateDetailsBean.class)
.add(Restrictions.eq("accountAssistantCode",new Integer(objOPCorrectionViewBean.getAccountAssistantCode())));
Criteria subCriteriaErrorAuth = criteriaCheque.createCriteria("objErrorAuthBean")
.setFetchMode("objErrorAuthBean",FetchMode.JOIN)
.add(Restrictions.conjunction().add(Restrictions.eq("errorcode",new Long(objOPCorrectionViewBean.getErrorcode())))
.add(Restrictions.ne("authorisationFlag",new Short((short)1))));
Criteria subCriteriaQuotationAcctDetails = criteriaCheque.createCriteria("objQuotationAcctDetailsBean")
.setFetchMode("objQuotationAcctDetailsBean",FetchMode.JOIN)
.add(Restrictions.disjunction().add(Restrictions.eq("accountTypeId",new Short((short)1))));
Criteria subCriteriaQuotationAcctDetails1 = criteriaCheque.createCriteria("objQuotationAcctDetailsBean")
.add(Restrictions.disjunction().add(Restrictions.not(
Restrictions.in("accountTypeId",new Short[]{new Short((short)2),new Short((short)3),new Short((short)4),new Short((short)5)}))));
Sql generated
select *
from (select this_.QTM_QTN_ID as QTM1_2_,
this_.QTM_AFF_RUT_ID as QTM2_3_2_,
this_.QTM_ROL_FOL_NN as QTM3_3_2_,
this_.QTM_IMG_FOL_NN as QTM4_3_2_,
this_.QTM_SEQ_NN as QTM5_3_2_,
this_.QTM_QTN_PRD_NN as QTM6_3_2_,
this_.QTM_PMT_FC as QTM7_3_2_,
this_.QTM_AFF_NM as QTM8_3_2_,
this_.QTM_PYR_RUT_ID as QTM9_3_2_,
this_.QTM_ACC_ASS_CD as QTM10_3_2_,
this_.EAD_ERR_AUT_NN as EAD11_3_2_,
quotationa2_.QAD_QTN_ACC_ID as QAD1_0_,
quotationa2_.QTM_QTN_ID as QTM2_5_0_,
quotationa2_.ATM_ACC_TYP_ID as ATM3_5_0_,
quotationa2_.QAD_DFF_ADQ_$$ as QAD4_5_0_,
quotationa2_.QAD_DFF_QOT_$$ as QAD5_5_0_,
quotationa2_.QAD_PMT_TYP_RE as QAD6_5_0_,
quotationa2_.QAD_ADL_QOT_$$ as QAD7_5_0_,
quotationa2_.QAD_ADL_PNP_$$ as QAD8_5_0_,
quotationa2_.QAD_PEN_QOT_$$ as QAD9_5_0_,
quotationa2_.QAD_QTN_QOT_$$ as QAD10_5_0_,
errorauthb1_.EAD_ERR_AUT_NN as EAD1_1_,
errorauthb1_.ERM_ERR_ID as ERM2_2_1_,
errorauthb1_.AXM_AUX_ID as AXM3_2_1_,
errorauthb1_.EAD_ATH_RE as EAD4_2_1_,
errorauthb1_.EAD_ATH_FC as EAD5_2_1_,
errorauthb1_.QTM_QTN_ID as QTM6_2_1_
from T_QUOTATION_MSTR this_ inner join T_QUOTATION_ACCT_DTLS quotationa2_ on this_.QTM_QTN_ID = quotationa2_.QTM_QTN_ID inner join T_ERROR_AUTH_DTLS errorauthb1_ on this_.QTM_QTN_ID = errorauthb1_.QTM_QTN_ID
where this_.QTM_ACC_ASS_CD = ? and
(errorauthb1_.ERM_ERR_ID = ? and errorauthb1_.EAD_ATH_RE <> ?) and
(quotationa2_.ATM_ACC_TYP_ID = ?))
I need left outer join between the two tables and Instead of " and " i need " or "....... " where this_.QTM_ACC_ASS_CD = ? and
(errorauthb1_.ERM_ERR_ID = ? and errorauthb1_.EAD_ATH_RE <> ?) and
(quotationa2_.ATM_ACC_TYP_ID = ?))
"and conditions is generated by hibernate not by me" so please give me the sugeestions to convert and conditions to or conditions