Dear all, I am using JBOSS 3.2.3 with CMP. Scenario : Client side insert a new record(say, record A) through EJB CMP entity bean. Then, I login to the database table and delete that record A manually. However, I found that the EJB CMP container doesn't synchronize with the database again. i.e. entity bean of record A is still there, although the record A has been deleted by me manually using database client software. I know EJB CMP usually call ejbLoad() and ejbStore() to synchronize the database. It seems it doesn't call these method. Do I need to config. the JBOSS CMP so that it can call these two methods regularly.
My guess is that JBoss comes out of the box with what may be called "commit option A" (that's my guess). There are three options as to how a container may handle the CMP Entity commit: A, B or C, the vendor is free to choose.
Option A: Bean stays connected to EJBObject and assumed to be in sync. (no ejbActivate & no ejbLoad) Option B: Bean stays connected but not in sync. ( no ejbActivate - but ejbLoad will be called) Option C: Bean is disconnected from EJBObject and goes back to pool. (ejbActivate & ejbLoad are both called)
You can tune JBoss via .../conf/standardjboss.xml search for <commit-option>
One can experience this by getting an Entity bean then going behind the container's back and changing the DB tables directly (SQL) and then seeing if the Entity reflects the change (I suggest just a column update).
I'm trying to figure out how to do this (tune JBoss), how to figure out which option is current for a given Entity Bean/Deployment, etc.
If an EJB does not provide a container configuration specification in the deployment unit ejb-jar, the container factory chooses a container configuration from the standardjboss.xml descriptor based on the type of the EJB. So, in reality there is an implicit configuration-name element for every type of EJB, and the mappings from the EJB type to default container configuration name are as follows:
container-managed persistence entity version 2.0 = Standard CMP 2.x EntityBean
container-managed persistence entity version 1.1 = Standard CMP EntityBean
bean-managed persistence entity = Standard BMP EntityBean