| Author |
how to handle session in EJB
|
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
|
|
I make a small loging application using ejb
this is loging jsp
this is userAuthorise servlet
this is sessionbean
this is entitybean
This application work fine.
No problem.
Anyway i need to know how to add session to this application.
Is it add to servlet or Ejb?
if it should EJB ,HOW?
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Not sure what "add sessioN" means, but you can choose to use an HTTP session or an EJB session as your needs require. Which one do you need?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
|
|
sesion mean conversional state.
or session mean i need to identify user when his made a second request that this is a his second request?
how can i archieve this using EJB?
I know how to do this using Servlets.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Use a stateful session bean.
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2229
|
|
The HTTPSession on to the JSP Page will be taken by the EJB Container and it will be rresponsible to maintain the Session in case of the Statefull Session Bean .
What Paul mentioned is right , use Statefull Session Bean
|
Save India From Corruption - Anna Hazare.
|
 |
ramprasad madathil
Ranch Hand
Joined: Jan 24, 2005
Posts: 489
|
|
use Statefull Session Bean
You would still need a session (or the equivalent of it) on the client to store a Handle to the stateful session bean.
ram.
|
 |
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
|
|
In this example i used Entity beans for Persistance.
I read that Entity beans are the worst part of EJB3.SO can we replace the Entity beans with Anyother thing?
|
 |
Jaikiran Pai
Saloon Keeper
Joined: Jul 20, 2005
Posts: 6564
|
|
Samanthi perera wrote:
I read that Entity beans are the worst part of EJB3.SO can we replace the Entity beans with Anyother thing?
Where did you read that? As I said in another post, there are no entity *beans* in EJB3. They are just entities. And I have never heard that they are the worst part of EJB3. EJB2.x entity beans, yes, that's a different story.
|
[My Blog] [JavaRanch Journal]
|
 |
Jaikiran Pai
Saloon Keeper
Joined: Jul 20, 2005
Posts: 6564
|
|
In this example i used Entity beans for Persistance.
By the way, how is that related to the original question that you started off with in this topic?
|
 |
Krum Bakalsky
Ranch Hand
Joined: Mar 14, 2010
Posts: 46
|
|
In this example i used Entity beans for Persistance.
Nope, you are wrong! You are not using entity beans at all! What you use, is called "entities", not entity beans.
Please put some effort to use the proper terminology.
Entity beans are EJB 2.1 legacy, and are managed by the EJB container (so they really are type of EJBs)
Entities are a JPA artifact, and they are not managed by the EJB container, but by the JPA provider instead (so they are not EJBs at all)
|
SCJP 6 (86% - the hard way), SCBCD 5 (81% - the hard way)
|
 |
 |
|
|
subject: how to handle session in EJB
|
|
|