-->
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: Auto Flush problem in joined-subclass?
PostPosted: Thu Jan 05, 2012 6:20 pm 
Newbie

Joined: Thu Jan 05, 2012 2:41 pm
Posts: 1
Hi All,

We are using joined-subclass for one of the classes in our application. The parent class mapping is like:

Code:
<hibernate-mapping>
   <class name="com.abc.LegalEntityRole" table="LEGAL_ENTITY_ROLE">
       <id name="dstBaseId" type="java.lang.String" unsaved-value="null" column="LEGAL_ROLE_ID">
           <generator class="uuid.hex" />
       </id>
   
       <property name="createDate" type="java.sql.Timestamp" column="CREATE_DT" not-null="true" length="10" />
       <property name="createUserCode" type="java.lang.String" column="CREATE_USER_CD" not-null="true" length="10" />
       <property name="updateDate" type="java.sql.Timestamp" column="LAST_MOD_DT" length="10"/>
       <property name="updateUserCode" type="java.lang.String" column="LAST_MOD_USER_CD" length="10" />
...
</hibernate-mapping>


The subclass mapping is like:
Code:
<hibernate-mapping>
   <joined-subclass name="com.abc.Customer" extends="com.abc.LegalEntityRole" table="CUSTOMER">
      <key column="CUST_ID" />

      <property name="customerNumber" type="string" column="CUST_NBR" not-null="true" length="20" />
      <property name="createDate" type="timestamp" column="CREATE_DT" not-null="true" length="10" />
      <property name="createUserCode" type="string" column="CREATE_USER_CD" not-null="true" length="10" />
      <property name="updateDate" type="timestamp" column="LAST_MOD_DT" length="10" />
      <property name="updateUserCode" type="string" column="LAST_MOD_USER_CD" length="10" />
...
</hibernate-mapping>


A daily batch job updates customer records along with last updated user code and timestamp fields (but not the LegalEntityRole).

PROBLEM: When we view the customer record using the UI after the job completed, the last updated user code and timestamp fields of the customer is getting updated automatically even before the data is loaded in screen. I believe this is happening as we are using AUTO FLUSH MODE and hibernate synchronizes the child record with parent record.

Named query used for fetching the customer for UI:
Code:
   <query name="findCustomerById">
      <![CDATA[from Customer cust
               join fetch cust.legalEntity le
...   </query>


Is there a way to avoid this AUTO FLUSH without using MANUAL FLUSH mode?

Thanks in advance!


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.