• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

accessing an ENtity bean from web?

 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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...
 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • 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
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • 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
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic