0

I am currently using JBoss 5.1.0 GA build for deploying my enterprise application. Am facing a strange issue w.r.t the working of EJBLocalHome remove() API. I have an Entity Bean say"Emp". I needs to delete an entity bean say 'emp1'. Hence i will call the EJBLocalObject remove() which will call the "Emp" EntityBean#ejbRemove() API to remove the bean from my database. remove() -> ejbRemove()

In case of Jboss AS, i observerd that when i call the remove() API, the ejbStore() API is being called first and then ejbRemove() API in the same transaction. During remove() API the Entity Bean is not being modified. Hence ejbStore() should not be called. But it does. Hence the sequence is:- remove() -> ejbStore() -> ejbRemove()

I deplyed my application on Websphere AS, and when i called the remove() the call sequence was:- remove() -> ejbRemove() . ejbStore() was not being called in this case.

Can anybody tell why such beahviour occurs in case of JBoss AS ? I feel ejbStore() should not be called as nothing has been updated and working should be similar to Webspehere.

-Ajit

Ajit
  • 53
  • 1
  • 1
  • 4

1 Answers1

0

It seems like JBoss specific issue. Saw the internal implementation of JBoss and found that it calls ejbStore when the the configuartion element 'sync-on-commit-only' is set to false. This property is present in the standardjboss.xml file and the default value is false. This is what the Jboss specification says for this element:- "This configures a performance optimization that will cause entity bean state to be synchronized with the database only at commit time. Normally the state of all the beans in a transaction would need to be synchronized when an finder method is called or when an remove method is called, for example."

Hence if 'sync-on-commit-only' is set to false then ejbStore() is called so that the entities are in sync with the datastore before the bean is removed.

The only thing i noticed that irrespective of whether this property is set to true/false the entity bean will be removed from the datasource. hence it still leaves me wondering why an ejbStore() call is required during remove() as eventually the bean will be removed from the datasource and put back to the instance pool.

-Ajit

Ajit
  • 53
  • 1
  • 1
  • 4