Why are you trying to write your own cache? EJB was designed for this stuff. Let JBoss do the (caching) job for you, it is probably even doing better than you can ever achieve by writing your own caching mechanism.
And if you don't believe me: why not just try it first? It's for free!
Make sure you use commit option A, this will minimize database transactions and cache the entity beans. Try it out, do measure the performance. You'll be surprised how fast it is.
yes the container sure does do caching.But isn't it a overhead to to maintain so many entity beans in ACTIVE state during a client session ?
> yes the container sure does do caching.But isn't it a
> overhead to to maintain so many entity beans in
> ACTIVE state during a client session ?
Sorry, i don't get your point. You can specify the size of the cache (min and max) in the jboss deployment descriptor. JBoss will try to keep the entity beans in memory, especially when you use commit option A. Yes, that will cost some memory, but that is what caching is about, isn't it? The advantage of letting JBoss do the caching is that it will dispose certain rarely used entity beans when the max size of the cache is reached.
Hope this does answer your question, if not let me know.