• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accessing an ENtity bean from web?

 
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic