> > I've read the EJB spec but I only found one error that happens when the > > load is called on my entity bean. The load is always called before an > > activate() even the entity bean isn't changed (read-only for instance), > > which would always eliminates my cache effect. > > Are you sure ejbLoad is called before ejbActivate in the same > transaction for the same instance? It should not happen. How could I > reproduce it? >
My mistake. Is called *after* the activate and *not before*. Sorry. > > > > So look at my sample below. First, the cache is false, and after the > > first business method is called the cache is set. The cache will be > > unset only when the load() is called that will be when the activate is > > called. > > > > I could remove the unset code in the load() but if my entity bean change > > (e.g. a store procedure) I won't be able to reload my entity bean data > > ever. > > Why? What do you mean? > Technical I can, but I won't be able to implement a cache mechanism with the any flag. I mean, I won't be able to know if data is really changed and I must process all data again, or if the cache should persist. Because the load() should happen always after a activate(), with changes or without them. BTW, can the scenario below happen ( it happened to me ): - I process some data (business method) and cache some data for the entity #1. - I let the entity bean go to passivate state. - I test the cache for the entity #2 and for the entity #1. The cache exist for the entity #2 but doesn't exist for entity #1. Both entity beans went to the pool, but when I invoked them again, the pool gave the objects swapped for the entity beans. So, if the cache is not possible to do in the entity beans, what is the need of the activate() if the load() will always occur? And, we cannot access to any of the entity beans methods there... regards, Pedro Salazar. -- -PS ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user