Hi,
I have used an association mapping in one of my hbm.xml. I have used the cascade=”lock” but the locking mechanism doesnot cascade to associated objects.
Could you let me know if there are any pre requisites for using cascade=”lock” Or if I need to look into other things.
An example of my mapping is as follows
In Company.hbm.xml
<set name="employees" table="EMPLOYEES" lazy="false" inverse="false" cascade="lock,all-delete-orphan"> <key column="COMPANY_ID"/> <one-to-many class="com.dao.EmployeeBean"/> </set>
I lock the company bean by calling:
CompanyBean companyBean = (CompanyBean) DBService.getInstance().lockData(CompanyBean.class, primaryKey,
LockMode.UPGRADE_NOWAIT);
I would also like to mention that I have a mapping for company in employee mapping
<many-to-one name="company" class="com.dao.CompanyBean " column=" COMPANY_ID " lazy="false"/>
|