Posted By:
Anonymous
Posted On:
Friday, November 15, 2002 05:42 AM
Hello, I'm using XDoclet tags to define a CMP EntityBean. The field VERSIONNO from my correspondent table is auto-generated (I set the parameter use-soft-locking="true"). .... * @ejb.bean * name="Company" * type="CMP" * local-jndi-name="ejb/CompanyLocalHome" * jndi-name="ejb/CompanyHome" * cmp-version="2.x" * view-type="local" * schema="COM_COMPANY" * primkey-field="oid" * use-soft-locking="true" .... public abstract int getVersion(); public abstract void setVersion(int version);
More>>
Hello,
I'm using XDoclet tags to define a CMP EntityBean. The field VERSIONNO from my correspondent table is auto-generated (I set the parameter use-soft-locking="true").
....
* @ejb.bean
* name="Company"
* type="CMP"
* local-jndi-name="ejb/CompanyLocalHome"
* jndi-name="ejb/CompanyHome"
* cmp-version="2.x"
* view-type="local"
* schema="COM_COMPANY"
* primkey-field="oid"
* use-soft-locking="true"
....
public abstract int getVersion();
public abstract void setVersion(int version);
....
Having these settings, the creation and update of records in this table auto-increase (from 0)
the value of field VERSIONNO. Great until now. But also an apparently inoffensive method also leads to an increase of this field! Concrete: I have a facade session bean which calls the above mentioned entity bean for a simple find, like this:
/**
* Returns one company
* @ejb.interface-method
* @ejb.transaction type="Required"
*/
public CompanyVO getCompany(String oid) throws CompanyNotFoundException, SystemException, AuthorizationException {
try {
home = CompanyUtil.getLocalHome();
CompanyLocal obj = home.findByPrimaryKey(oid);
CompanyVO vo = new CompanyVO();
vo.setOid(obj.getOid());
/* ...other setters called... */
return vo;
} catch (Exception e) {
}
return null;
}
Is this behavior normal? I expected VERSIONNO to be increased only when the record is updated in database. Did I set something wrong? I even tested some other transactional behaviors for this method, but nothing good happened. Can I get some help?
Thank you in advance,
Cristina
<<Less