-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Query by Example creates an update statement
PostPosted: Mon Oct 17, 2005 5:01 pm 
Newbie

Joined: Thu Feb 17, 2005 3:01 pm
Posts: 9
Query by Example is causing the object to be updated .
Any help would be appreciated
Thanks
murparth




Hibernate version:
Hibernate Version : 3.00

ConCalcDetail object has a set of ConCalcSchedules.
We are using session per Request pattern.


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>
<!--
Created by the Middlegen Hibernate plugin 2.1

http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="com....model.contract.ConCalcDetail"
table="RESD_CON_CALC_DTL" optimistic-lock="version"
>

<meta attribute="extends" inherit="false">com....model.BaseModel</meta>

<id
name="resdId"
type="java.lang.Long"
column="CON_CALC_DTL_ID"
>
<generator class="native" />
</id>
<discriminator column="CALC_DETAILS_TYPE" type="string" />

<version name="version"
access="field"
unsaved-value="undefined"
type="integer"
column="version" >
</version>


<property
name="creationDate"
type="java.sql.Timestamp"
column="CREATION_DATE"
length="7"
/>
<property
name="modifiedDate"
type="java.sql.Timestamp"
column="MODIFIED_DATE"
length="7"
/>
<property
name="activeFlag"
type="yes_no"
column="ACTIVE_FLAG"
length="2"
/>

<property name="videoUnitsExempt"
type="java.math.BigDecimal"
column="VIDEO_UNITS_EXEMPT"
length="22">
</property>

<property name="exhibitionDaysExempt"
type="java.math.BigDecimal"
column="EXHIBITION_DAYS_EXEMPT"
length="22">
</property>

<property
name="denominator"
type="java.math.BigDecimal"
column="DENOMINATOR"
length="22">
</property>

<property name="floorPercent"
type="java.math.BigDecimal"
column="Floor_percent"
length="22">
</property>

<property name="ceilingPercent"
type="java.math.BigDecimal"
column="CEILING_PERCENT"
length="22"></property>
<property name="longFormFloorPercent"
type="java.math.BigDecimal"
column="long_form_floor_percent"
length="22"></property>

<property name="insuranceFeePercent"
type="java.math.BigDecimal"
column="insurance_fee_percent"
length="22"></property>

<property name="retirementFeePercent"
type="java.math.BigDecimal"
column="retirement_fee_percent"
length="22"></property>

<property name="administrationFeePercent"
type="java.math.BigDecimal"
length="22"
column="ADMINISTRATION_FEE_PERCENT">
</property>

<property name="discountPercent"
type="java.math.BigDecimal"
column="discount_percent"
length="22">
</property>

<property name="resolvedPayType"
type="java.lang.Long"
length="22"
column="RESOLVED_PAY_TYPE"></property>

<!-- Associations -->


<many-to-one
name="paymentMethod"
class="com....model.system.lookup.ResidualsLookup"
lazy="true"
not-null="true"
>
<column name="PAY_METHOD_CODE" />
</many-to-one>

<many-to-one
name="payType"
class="com....model.system.lookup.ResidualsLookup"
not-null="false"
lazy="true"
cascade="none"
>
<column name="PAY_TYPE_CODE" />
</many-to-one>

<many-to-one
name="contract"
class="com....model.contract.Contract"
not-null="true"
cascade="none"
>
<column name="CON_ID" />
</many-to-one>

<many-to-one
name="status"
class="com....model.system.lookup.ResidualsLookup"
lazy="false"
not-null="false"
fetch="join"
not-found="ignore"
outer-join="true"

>
<column name="STATUS_CODE" />
</many-to-one>



<set
name="conCalcSchedules"
lazy="false"
inverse="true"
fetch="join"
outer-join="true"
cascade="all-delete-orphan"
order-by="EFFECTIVE_START_DATE asc , EFFECTIVE_END_DATE "
>
<key>
<column name="CON_CALC_DTL_ID" />
</key>
<one-to-many class="com....model.contract.ConCalcSchedule" />
</set>

<many-to-one
name="contractQualifier"
class="com....model.system.qualifier.QualifierCombination"
not-null="false"
lazy="true"
>
<column name="QUAL_COMBO_ID" />
</many-to-one>


<many-to-one name="fundType"
class="com....model.system.lookup.ResidualsLookup"
lazy="true"
not-null="false"
>
<column name="FUND_TYPE_CODE"></column>
</many-to-one>

<property name="payCode"
length="100"
column="pay_code"
type="java.lang.String"
></property>

<many-to-one name="prorationCode"
class="com....model.system.lookup.ResidualsLookup"
not-null="false"
lazy="true">
<column name="PRORATION_CODE"></column>
</many-to-one>

<many-to-one name="postProrationCode"
class="com....model.system.lookup.ResidualsLookup"
not-null="false"
lazy="true">
<column name="POST_PRORATION_CODE"></column>
</many-to-one>


<property name="reduceResiduals"
type="yes_no"
column="REDUCE_RESD_FLAG"
length="2"/>

<property name="calcEmplReceiptPercent"
type="yes_no"
column="sys_calc_empl_rcpt_percent"
length="2"></property>

<property
name="calcEmplMinutesPercent"
type="yes_no"
length="2"
column="sys_calc_empl_min_percent"
>
</property>

<property name="postCalcEmplReceiptPercent"
type="yes_no"
column="post_calc_empl_rcpt_percent"
length="2"></property>

<property
name="postCalcEmplMinutesPercent"
type="yes_no"
length="2"
column="post_sys_calc_empl_min_percent"
>
</property>


<subclass name="com....model.contract.ConDefaultCalc" discriminator-value="CONCALCDEFAULT" >
<property
name="defaultContractId"
type="java.lang.Long"
column="DEFAULT_CON_ID"
length="20"
/>


</subclass>
<subclass name = "com....model.contract.ConProdCalc" discriminator-value="CONPRODCALC" >
<many-to-one
name="product"
class="com....model.product.Product"
not-null="true"
lazy="true"
>
<column name="PROD_ID" />
</many-to-one>

<property
name="cast"
type="java.lang.Long"
column="CAST_ID"
not-null="false"
/>

</subclass>
<subclass name="com....model.contract.ConQualCalc" discriminator-value="CONQUALCALC">

</subclass>

</class>
</hibernate-mapping>


<?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>
<!--
Created by the Middlegen Hibernate plugin 2.1

http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->

<class
name="com....model.contract.ConCalcSchedule"
table="RESD_CON_CALC_SCHED" optimistic-lock="version"
>

<meta attribute="extends" inherit="false">com....model.BaseModel</meta>

<id
name="resdId"
type="java.lang.Long"
column="CON_CALC_SCHED_ID"
>
<generator class="native" />
</id>

<version name="version"
access="field"
unsaved-value="undefined"
type="integer"
column="version" >
</version>


<property
name="creationDate"
type="java.sql.Timestamp"
column="CREATION_DATE"
length="7"
/>
<property
name="modifiedDate"
type="java.sql.Timestamp"
column="MODIFIED_DATE"
length="7"
/>
<property
name="activeFlag"
type="yes_no"
column="ACTIVE_FLAG"
length="2"
/>

<property
name="effectiveStartDate"
type="java.util.Date"
column="effective_start_date"
not-null="false"
length="7"
/>
<property
name="effectiveEndDate"
type="java.util.Date"
column="effective_end_date"
not-null="false"
length="7"
/>

<property name="scheduleClassName"
length="200"
type="java.lang.String"
column="SCHEDULE_TYPE">
</property>


<many-to-one
name="calcDetail"
class="com....model.contract.ConCalcDetail"
not-null="true"
cascade="none"
lazy="true"
>
<column name="CON_CALC_DTL_ID" />
</many-to-one>



<many-to-one
name="schedule"
class="com....model.system.schedule.Schedule"
cascade="none"
not-null="true"
lazy="true"
>
<column name="SCHED_ID" />
</many-to-one>

<property name="placeHolder"
type="yes_no"
column="PLACE_HOLDER_FLAG"
length="2"
/>
<many-to-one name="fundType"
class="com....model.system.lookup.ResidualsLookup"
lazy="true"
not-null="false"
>
<column name="FUND_TYPE_CODE"></column>
</many-to-one>

<property name="releaseFromDate"
type="java.sql.Timestamp"
column="RELEASE_FROM_DATE"
length="7"/>

<property name="releaseToDate"
type="java.sql.Timestamp"
column="RELEASE_TO_DATE"
length="7" />

<!-- many-to-one name="payCode"
lazy="true"
not-null="false"
class="com....model.system.lookup.ResidualsLookup">
<column name="PSFT_PAY_CODE"></column>
</many-to-one -->

<property name="payCode"
length="100"
column="pay_code_new"
type="java.lang.String"
></property>

<property name="pensionPercent"
type="java.math.BigDecimal"
column="PENSION_CONTRIB_PERC"
length="22"
/>
<many-to-one name="prorationCode"
class="com....model.system.lookup.ResidualsLookup"
not-null="false"
lazy="true">
<column name="PRORATION_CODE"></column>
</many-to-one>

<property name="reduceResiduals"
type="yes_no"
column="REDUCE_RESD_FLAG"
length="2"/>

<property name="calcEmplReceiptPercent"
type="yes_no"
column="sys_calc_empl_rcpt_percent"
length="2"></property>

<property
name="calcEmplMinutesPercent"
type="yes_no"
length="2"
column="sys_calc_empl_min_percent"
>
</property>

<property name="switchTo"
type="yes_no"
length="2"
column="switch_to"></property>

</class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():


Business tier
schedules.addAll(this.contractApprovalDAO.findCalcDetailSchedulesByScheduleType(scheduleType,conCalcDetail));


DAO tier

session = HibernateSessionFactory.currentSession();
criteria = session.createCriteria(ConCalcSchedule.class);
criteria.add(Restrictions.eq("calcDetail",conCalcDetail));
criteria.add(Restrictions.eq("scheduleClassName",scheduleType));
criteria.addOrder(Order.asc("effectiveStartDate"));
criteria.addOrder(Order.asc("effectiveEndDate"));
schedules = criteria.list();


Full stack trace of any exception that occurs:



Name and version of the database you are using:
Oracle 10G

The generated SQL (show_sql=true):


Hibernate: select qualifierc0_.QUAL_COMBO_ID as QUAL1_7_, qualifierc0_.version as version8_7_, qualifierc0_.CREATION_DATE as CREATION3_8_7_, qualifierc0_.MODIFIED_DATE as MODIFIED4_8_7_, qualifierc0_.ACTIVE_FLAG as ACTIVE5_8_7_, qualifierc0_.SHOWLENGTH_QUAL_CODE as SHOWLENGTH6_8_7_, qualifierc0_.GENRE_QUAL_CODE as GENRE7_8_7_, qualifierc0_.FORMAT_QUAL_CODE as FORMAT8_8_7_, qualifierc0_.EPISODIC_QUAL_CODE as EPISODIC9_8_7_, qualifierc0_.SHOOTING_METHOD_QUAL_CODE as SHOOTING10_8_7_, qualifierc0_.BUDGET_CAT_QUAL_CODE as BUDGET11_8_7_, qualifierc0_.WRITER_FORMULA_QUAL_CODE as WRITER12_8_7_, qualifier1_.Qual_code as Qual1_0_, qualifier1_.version as version6_0_, qualifier1_.CREATION_DATE as CREATION3_6_0_, qualifier1_.MODIFIED_DATE as MODIFIED4_6_0_, qualifier1_.ACTIVE_FLAG as ACTIVE5_6_0_, qualifier1_.DISPLAYED_VALUE as DISPLAYED6_6_0_, qualifier1_.DESCRIPTION as DESCRIPT7_6_0_, qualifier1_.QUALIFIER_TYPE as QUALIFIER8_6_0_, qualifiert2_.Qualifier_type as Qualifier1_1_, qualifiert2_.version as version7_1_, qualifiert2_.CREATION_DATE as CREATION3_7_1_, qualifiert2_.MODIFIED_DATE as MODIFIED4_7_1_, qualifiert2_.ACTIVE_FLAG as ACTIVE5_7_1_, qualifiert2_.DISPLAYED_VALUE as DISPLAYED6_7_1_, qualifier3_.Qual_code as Qual1_2_, qualifier3_.version as version6_2_, qualifier3_.CREATION_DATE as CREATION3_6_2_, qualifier3_.MODIFIED_DATE as MODIFIED4_6_2_, qualifier3_.ACTIVE_FLAG as ACTIVE5_6_2_, qualifier3_.DISPLAYED_VALUE as DISPLAYED6_6_2_, qualifier3_.DESCRIPTION as DESCRIPT7_6_2_, qualifier3_.QUALIFIER_TYPE as QUALIFIER8_6_2_, qualifier4_.Qual_code as Qual1_3_, qualifier4_.version as version6_3_, qualifier4_.CREATION_DATE as CREATION3_6_3_, qualifier4_.MODIFIED_DATE as MODIFIED4_6_3_, qualifier4_.ACTIVE_FLAG as ACTIVE5_6_3_, qualifier4_.DISPLAYED_VALUE as DISPLAYED6_6_3_, qualifier4_.DESCRIPTION as DESCRIPT7_6_3_, qualifier4_.QUALIFIER_TYPE as QUALIFIER8_6_3_, qualifier5_.Qual_code as Qual1_4_, qualifier5_.version as version6_4_, qualifier5_.CREATION_DATE as CREATION3_6_4_, qualifier5_.MODIFIED_DATE as MODIFIED4_6_4_, qualifier5_.ACTIVE_FLAG as ACTIVE5_6_4_, qualifier5_.DISPLAYED_VALUE as DISPLAYED6_6_4_, qualifier5_.DESCRIPTION as DESCRIPT7_6_4_, qualifier5_.QUALIFIER_TYPE as QUALIFIER8_6_4_, qualifier6_.Qual_code as Qual1_5_, qualifier6_.version as version6_5_, qualifier6_.CREATION_DATE as CREATION3_6_5_, qualifier6_.MODIFIED_DATE as MODIFIED4_6_5_, qualifier6_.ACTIVE_FLAG as ACTIVE5_6_5_, qualifier6_.DISPLAYED_VALUE as DISPLAYED6_6_5_, qualifier6_.DESCRIPTION as DESCRIPT7_6_5_, qualifier6_.QUALIFIER_TYPE as QUALIFIER8_6_5_, qualifier7_.Qual_code as Qual1_6_, qualifier7_.version as version6_6_, qualifier7_.CREATION_DATE as CREATION3_6_6_, qualifier7_.MODIFIED_DATE as MODIFIED4_6_6_, qualifier7_.ACTIVE_FLAG as ACTIVE5_6_6_, qualifier7_.DISPLAYED_VALUE as DISPLAYED6_6_6_, qualifier7_.DESCRIPTION as DESCRIPT7_6_6_, qualifier7_.QUALIFIER_TYPE as QUALIFIER8_6_6_ from RESD_PROD_QUAL_COMBO qualifierc0_ left outer join RESD_QUAL qualifier1_ on qualifierc0_.GENRE_QUAL_CODE=qualifier1_.Qual_code left outer join RESD_QUALIFIER_TYPE qualifiert2_ on qualifier1_.QUALIFIER_TYPE=qualifiert2_.Qualifier_type left outer join RESD_QUAL qualifier3_ on qualifierc0_.FORMAT_QUAL_CODE=qualifier3_.Qual_code left outer join RESD_QUAL qualifier4_ on qualifierc0_.EPISODIC_QUAL_CODE=qualifier4_.Qual_code left outer join RESD_QUAL qualifier5_ on qualifierc0_.SHOOTING_METHOD_QUAL_CODE=qualifier5_.Qual_code left outer join RESD_QUAL qualifier6_ on qualifierc0_.BUDGET_CAT_QUAL_CODE=qualifier6_.Qual_code left outer join RESD_QUAL qualifier7_ on qualifierc0_.WRITER_FORMULA_QUAL_CODE=qualifier7_.Qual_code where qualifierc0_.QUAL_COMBO_ID=?
Hibernate: select qualifiert0_.Qualifier_type as Qualifier1_0_, qualifiert0_.version as version7_0_, qualifiert0_.CREATION_DATE as CREATION3_7_0_, qualifiert0_.MODIFIED_DATE as MODIFIED4_7_0_, qualifiert0_.ACTIVE_FLAG as ACTIVE5_7_0_, qualifiert0_.DISPLAYED_VALUE as DISPLAYED6_7_0_ from RESD_QUALIFIER_TYPE qualifiert0_ where qualifiert0_.Qualifier_type=?
Hibernate: update RESD_CON_CALC_SCHED set version=?, CREATION_DATE=?, MODIFIED_DATE=?, ACTIVE_FLAG=?, effective_start_date=?, effective_end_date=?, SCHEDULE_TYPE=?, CON_CALC_DTL_ID=?, SCHED_ID=?, PLACE_HOLDER_FLAG=?, FUND_TYPE_CODE=?, RELEASE_FROM_DATE=?, RELEASE_TO_DATE=?, pay_code_new=?, PENSION_CONTRIB_PERC=?, PRORATION_CODE=?, REDUCE_RESD_FLAG=?, sys_calc_empl_rcpt_percent=?, sys_calc_empl_min_percent=?, switch_to=? where CON_CALC_SCHED_ID=? and version=?
Hibernate: select this_.CON_CALC_SCHED_ID as CON1_0_, this_.version as version2_0_, this_.CREATION_DATE as CREATION3_2_0_, this_.MODIFIED_DATE as MODIFIED4_2_0_, this_.ACTIVE_FLAG as ACTIVE5_2_0_, this_.effective_start_date as effective6_2_0_, this_.effective_end_date as effective7_2_0_, this_.SCHEDULE_TYPE as SCHEDULE8_2_0_, this_.CON_CALC_DTL_ID as CON9_2_0_, this_.SCHED_ID as SCHED10_2_0_, this_.PLACE_HOLDER_FLAG as PLACE11_2_0_, this_.FUND_TYPE_CODE as FUND12_2_0_, this_.RELEASE_FROM_DATE as RELEASE13_2_0_, this_.RELEASE_TO_DATE as RELEASE14_2_0_, this_.pay_code_new as pay15_2_0_, this_.PENSION_CONTRIB_PERC as PENSION16_2_0_, this_.PRORATION_CODE as PRORATION17_2_0_, this_.REDUCE_RESD_FLAG as REDUCE18_2_0_, this_.sys_calc_empl_rcpt_percent as sys19_2_0_, this_.sys_calc_empl_min_percent as sys20_2_0_, this_.switch_to as switch21_2_0_ from RESD_CON_CALC_SCHED this_ where this_.CON_CALC_DTL_ID=? and this_.SCHEDULE_TYPE=? order by this_.effective_start_date asc, this_.effective_end_date asc


Debug level Hibernate log excerpt:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.