aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Loading and Caching Entity Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Loading and Caching Entity Beans" Watch "Loading and Caching Entity Beans" New topic
Author

Loading and Caching Entity Beans

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 579
Lets say at server startup I want to load an entire table say customer into memory.
Each entity bean maps to a row, how would I load each row into each entity bean in one call. So far all I have seen are examples of a session bean calling one entity bean.
Lets say I want to load a 100 customers, would I use one session bean with a loop calling each entity bean in turn. In all the examples I have seen the connection is created in the Entity bean, but if I use that method here then in my loop I would be opening and closing a connection 100 times.
The way I see it I would open the connection, then pass the connection to each entity bean home interface.
Is there another neater way, is there a way to configure a server like weblogic to set up this Entity Bean cache for me.
Thanks for any help Tony
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Yes, it's called "Option A EJB Caching" and it's supported by all EJB servers. (Read the EJB spec for more information...) Do a search of the WebLogic documentation (or a google search) for "Option A" and you'll find out how to set it.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Also -- are you only looking at BMP examples? Have you considered CMP?
Kyle
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Loading and Caching Entity Beans