File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes accessing an ENtity bean from web? 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 "accessing an ENtity bean from web?" Watch "accessing an ENtity bean from web?" New topic
Author

accessing an ENtity bean from web?

Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

I have a Combo box that gets its options from an entity bean (Home.FindAll()). This is probably a little light of a job for an entity bean, but I couldn't see any easier solution that would not hit the DB so frequently.
Anyway, the problem is my JSP is going to have to lookup the entity bean and I feel bad about doing that from a JSP. I tend to think I should just do it from a servlet.
Any opinions on this?
I am trying with all my might to never generate a web page from a servlet, but I am failing here...
james edwin
Ranch Hand

Joined: Nov 22, 2001
Posts: 393
Hi,
When u raccessing Enitity bean through WEB,suppose 100 hits are coming per min,then that means 100 times you have to look up JNDI and get Remote Reference.
Just avoid this u can use Service Locator Pattern,which will improves proformance and response time.
Have a look into this http://developer.java.sun.com/developer/restricted/patterns/ServiceLocator.html
Cheers,
James


Regards,
James
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by CL Gilbert:
I have a Combo box that gets its options from an entity bean (Home.FindAll()). This is probably a little light of a job for an entity bean, but I couldn't see any easier solution that would not hit the DB so frequently.

Actually, unless you are using commit option A or a vendor optimization for caching and CMP 2.0, Entity Beans will tend to hit the database MORE than just a straight JDBC call.
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

I would have expected that once the entity bean is loaded, it can be recycled for use by other incoming requests. its basically read only so It should really just hit the DB once. In theory at least.
truthfully I have seen my JBOss setup thrash the db on a getAll() finder. its bizarre.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
That's the difference between commit options A, B and C as described in the EJB spec -- go take a quick gander at those and it should clear things up.
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: accessing an ENtity bean from web?