-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Herve Tchepannou
Sent: 17 September 2001 15:20
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Strange problem with BMP entity bean caching - incorrect values found by findByPrimaryKey()What is the transaction setting of ur bean and modifyDetails()?
are u sure that they are at 'Required'?-----Original Message-----
From: Adam Lipscombe [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 17, 2001 9:58 AM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] Strange problem with BMP entity bean caching -
incorrect values found by findByPrimaryKey()
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 point3. 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
Title: RE: [JBoss-user] Strange problem with BMP entity bean caching - incorrect values found by findByPrimaryKey()
Yes,
that's it - you have hit the nail on the head.
The
transaction attrib for modifyDetails was "supports".
You
live and learn....
Thanks
very much!
Cheers
- Adam
- [JBoss-user] Strange problem with BMP entity bean caching... Adam Lipscombe
- RE: [JBoss-user] Strange problem with BMP entity bea... Herve Tchepannou
- Adam Lipscombe
