Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7803655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:39:18+00:00 2026-06-02T01:39:18+00:00

I am new to EJBs and recently started working on EJBs (3.0). I have

  • 0

I am new to EJBs and recently started working on EJBs (3.0). I have been using Java for 6 years but never worked with EJB’s before. I am overwhelmed with the complexity of the whole EJB business to say the least. I fail to understand where I can practically apply some of the concepts.

One question which comes to my mind after understanding the Stateless session bean is, Can you not always replace a stateless session bean with a shared instance of a class with no local members (effectively making it stateless)? I read about instance pooling being done for stateless session beans. If there is no state, can you not simply use one instance?

I am deploying my samples on OpenEJB and one place where I had to use stateless session bean was to interact with the EntityManager. I am not sure if I can get handle to the EntityManager in an arbitrary class. Apart from that, still puzzled what problem stateless session bean tries to solve.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:39:19+00:00Added an answer on June 2, 2026 at 1:39 am

    A stateless session bean may have state. But it may not have conversational state. So it’s perfectly acceptable that a session bean method does the following (although bad practice):

    public void foo() {
        this.someVar = bar();
        this.someOtherVar = baz();
        zing();
    }
    

    Besides pooling, the EJB container provides several services with stateless beans:

    • dependency injection
    • declarative transaction demarcation
    • declarative security
    • access to the EJB context
    • etc.

    So a stateless session bean is much more useful than a simple stateless singleton.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new with EJB's and GWT but I've been using Java for a
What are the primary reasons for using the Java EE (EJBs) over just a
I have a Java EE web application using features from the Java EE 6
I'm new to Java EE and see that EJBs are alive and well within
I am new to Java web development (but not new to Java/OOPs). I am
This question would not have existed if AspectJ worked the same way as EJB
I'm fairly new to EJBs and full blown application servers like JBoss, having written
I am new to the world of EJBs and I am going thro HFEJB
New to javascript/jquery and having a hard time with using this or $(this) to
New to both Ruby and Rails but I'm book educated by now (which apparently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.