Have you tried putting a "required" in the transaction for the entity bean?
Also, if the session bean is not using the entity bean to make the change in
the table, you can't use any of the j2ee transaction stuff. I would only
change the table 2 through the entity bean. You can do that in the session
bean by calling the home, and findby to grab your entity bean, then make the
change to table 2. This way you always have the bean fresh.

If you are worried about having lots of beans lying around, you can make
sure that you only have one instance of your entity bean in your session
bean. The petstore example in the j2ee blueprint uses this approach.

Regards,

Lawrence


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Peter
Delahunty
Sent: Thursday, October 12, 2000 4:02 AM
To: Orion-Interest
Subject: Invalidating an Entity bean


Hi gurus

How do I do this cleanly.

I have and Entity that has attributes A,B,C and D. These attributes are all
read from database tables.

A and B are read from Table 1
C and D are read from Table 2

So I have Entity Bean 1, this is loaded by the app server (perhaps by a
findByPrimaryKey) method. This means that Entity Bean 1 is now a cache of
the data in A,B,C and D.

However while this entity bean is in the cache, via a session bean I change
the data of C and D in table 2. This mean that Entity Bean 1 now has dirty
data. So the question is how do I force the Entity beans to do and EJB Load.


Also the data in C and D in table 2 may be shared by N number of entity
beans so I may need to refresh N number of Entity Beans depending on which
ones are in the cache.

I only want to call EJB load for Entity beans currently in the cache and of
these I only want to call ejb load for the ones that refer to the changed
data.

Cheers Peter


Reply via email to