Folks,


JBoss 2.4.0 with Tomcat 3.2.3
-----------------------------

I have a strange problem that has completely foxed me:

The sequence of events on a BMP entity bean is as follows. All steps are
called from a client in separate transactions:

1. Bean Created

2. Bean Read
   State OK at this point

3. Bean Updated
   State written to DB OK, beans internal value object is updated OK.

4. Bean Read.
   State retrieved is state *before* update in step 3.

5  Bean Updated

6. Bean Read


The problem is that the read at (4) retrieves the bean state that was
present *before* the update at (3) was processed.

I have checked the database and the update in (3) does get written to the
DB.
I have debugged the code and the ejbStore() and ejbLoad() methods get called
as expected.

As far as I can see, the cached bean does not accurately reflect the
contents of the DB.
Its almost as if findByPrimaryKey() is getting the wrong bean instance from
the cache.


I am using commit-option A as JBoss is only thing talking to the DB.

The code that updates the bean is as follows: (Note "details" is a
ContactModel value object instance)

------------------
// Find Contact instance first in case it does not exist
ContactKey primaryKey = details.getContactPrimaryKey();
Contact contact = contactHome.findByPrimaryKey(primaryKey);

// Modify Bean and re-read in case DB has massaged the data
contact.modifyDetails(details);
contact = contactHome.findByPrimaryKey(primaryKey);
ContactModel updatedDetails = contact.getDetails();
-------------------


and the ejbStore method looks like: (contactDetails is the beans internal
value object holding the bean state)

---------------------
try
{
  setDAO();
  this.contactDetails = (ContactModel)
contactDao.update(this.contactDetails);
  modified = false;

  logger.info("contact bean stored, contactDetails = " +
this.contactDetails);
 }
 catch (DAOFinderException ex)
 {
  context.setRollbackOnly();
  throw new NoSuchEntityException(ex.getMessage());
}
catch (DAOApplicationException ex)
{
  context.setRollbackOnly();
  throw new EJBException(ex.getMessage());
}
catch (DAOSystemException ex)
{
  context.setRollbackOnly();
  throw new EJBException(ex.getMessage());
}
--------------------





Does anyone have any ideas? I am completely stumped...


Thanks in advance - Adam




_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to