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!