• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB and data sharing

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi:
I have never used EJB. I have a design issues, and I was told that using EJB could solve the problem, if so, I am going to study for the Cert.
The issue is, how to share information among all the component of the application, without quering the database often. ServletContext object doesn't work, becuase the information stored in the database con be changed at any time. Reintializing the ServeletContext object doesn't work, becuase the application is running on a clusterd app. server.
The summary: How can I share dynamic data in the application scope, without using database, or ServletContext object?
Can EJB do just that?
thanks
 
Anthony Castillon
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried putting your objects (i.e. value objects populated from the database query) as attributes on session or application scope?
anthony
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Anthony for your reply.
Yes I have tried the application scope by storing the data in the ServletContext object. It works fine until the data in the database is changed. If the data in the database is changed, I have to reintialize the ServletContext object manualy, or redeploy the application, which is unecceptable. It would work fine in a one box application server, but in a clustered application server, they have more than one JVM, and each JVM has its own copy of the ServletConext object, hence, you have to reintialize them all. It is a cumbersom, and complicated task.
The session attribute will not work. The data to be shared is large, and it is the same for every group of users. If I save it in a user session, I will end up with a lote of huge and duplicate data in the memory.
any other suggestions.
thanks
[ April 06, 2004: Message edited by: Hanna Habashy ]
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the thread is coming into a servlet issue or SCWCD issue...
Anyway, I believe that your problem can be solved by EJB... But I'm not that expert in EJB, I hope that EJB experts in EJB forum can help you more about EJB things, rather than exam aspirants here in this forum... I'm just providing an alternative for the possible solution...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic