• 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

how to handle session in EJB

 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use a stateful session bean.
 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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)

 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic