SCJP 1.2
1. in Stateless Session Beans we use Pool of Stateless Session Bean.
BUT
2. In Stateful Session Beans there is No Pooling, we use Caches.
So what is the difference b/w Pooling and Caching ?
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I would say that caching is some temporary storing of data to avoid the costly retrieval of data from some storage say database.
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
A good CMP implementation does provide a caching layer behind the curtains.What about entity beans ? I would not call stateful session beans as cache but certainly entity beans?
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
SCJP 1.2
but still i m not clear about Sateful Session Bean is there something called Caching is used or not??
As---->
1. EJB Specification does not allow pooling of StateFulSessionBean.
2. But most of the AppServer uses Instance caches.
so what is diff in terms of Pooling for StateLess Session Beans
and Instance Caching of StateFul Session Beans.
Lasse regardin Naming convention my Public Name is correct so why were u pointed me to that page?
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
SCJP 1.2
When we mention "caching" do we mean that the implementation might cache the results of a finder for eg?
Yes there is, that's why the container will passivate entity beans as needed.Is there a probablility of the server memory getting clogged with bean instances and as a result make the entire app slow?
If you have two applications using the same database and the other application has some cached data, it will not get any notice from the database when the other application inserts something. The same applies within a single application. If you have an entity bean layer and use JDBC to write stuff into the same tables, the database will not inform the entity bean layer about the changes. It's still safe to use JDBC for big read-only operations (e.g. search against a huge database of articles) but you better not use JDBC to manage the same database tables as your entity bean layer is using.W'd caching cause a problem when the same database is being used by different applications? / even simpler, if I use a different mechanism (pure JDBC, assumign that any practical EJB solution w'd, in all probablity have a bean and a faster non-ejb approach bundled together ) to get in some data into the database?, do we expect the finder to return some cached data and not do a look up again since some of the data never went thro' the EJB layer in the first place? I mean in general, is switching caching on/off a tricky thing?
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Originally posted by karthik Guru:
oh so you are saying that we s'dnt be having an Entity bean mapping to such tables in the first place? I might have some entities that have some kind of relationship with those tables. Kind of wonder if persisting them w'd actually mean using jdbc and CMP at the same time :-(
Originally posted by Chris Mathews:
What Lasse is saying is that if you have the Application Server caching Entities Bean and you go behind its back and change the underlying value (via straight JDBC or whatever) then you are in for trouble. If you are employing a heavy caching approach then all changes must go thru the Entity Bean layer in order to maintain data integrity.
[ August 13, 2003: Message edited by: Chris Mathews ]
Originally posted by karthik Guru:
The way we might have large read only operations on a table ( where we can use JDBC) , we might have large inserts as well into the same table. Using ejbCreate for such huge entries w'd obviosuly take ages to get the data in.
Originally posted by karthik Guru:
So my question is that since the table might be read / written to (both might involve huge reads/writes), s'd we not have an entity bean at all to model that table?
Hence the follow up question that
if i have another entity bean that has some kind of relationship with those tables, i w'd end up with a CMP bean create and JDBC code @ the same time.
Yeah perfectly achieveable..but for some reason i found that a little dirty.
..
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|