• Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity Bean and find() method  RSS feed

 
Paul Medford
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I need some clarification regarding Entity Beans and the find() methods.
1) Users who retrieve a same record from a database using an Entity Bean, do they all have their own copy (instance) of the Entity Bean or do they all share one single instance of the bean?
2) Let's suppose a user finds a record in the database through an Entity Bean using a servlet. Once the page is displayed in the browser and the connection is closed, does the Entity Bean return immediately to the pool and therefore looses its state, or does it keep its state for the next call (in a sense caching the data for faster retrieval)?
3) Let's assume a search engine uses EJBs. If a user searches for a word that is found in say 1 million pages using a find() method, does it mean that 1 million Entity Beans were created?
4) I queried Google for the word 'eye' and it found over 9.7 million pages in just .11 seconds. Whereas it is taking for ever to find only 100,000 records on my machine. Is it just a matter of computing power or something else?
Any thought?
Francois
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Francois Merle:
Hello all,
I need some clarification regarding Entity Beans and the find() methods.
1) Users who retrieve a same record from a database using an Entity Bean, do they all have their own copy (instance) of the Entity Bean or do they all share one single instance of the bean?

Unless you are using Option A caching the answer is they each get their own instances.

2) Let's suppose a user finds a record in the database through an Entity Bean using a servlet. Once the page is displayed in the browser and the connection is closed, does the Entity Bean return immediately to the pool and therefore looses its state, or does it keep its state for the next call (in a sense caching the data for faster retrieval)?

Unless you are using Option A caching it loses its state. This is all covered in the specification under the different Caching options (Options A, B and C).

3) Let's assume a search engine uses EJBs. If a user searches for a word that is found in say 1 million pages using a find() method, does it mean that 1 million Entity Beans were created?

Yes.

4) I queried Google for the word 'eye' and it found over 9.7 million pages in just .11 seconds. Whereas it is taking for ever to find only 100,000 records on my machine. Is it just a matter of computing power or something else?
Any thought?
Francois

The answer is that google is using very optimized search technology, not a general purpose technology like EJB's. It's also doing most of its work in the database. That's the key to making fast searches even with EJB's -- let the database do all of the work.
Kyle

------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!