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 9242949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:41:53+00:00 2026-06-18T08:41:53+00:00

ALL, I am a newbie for EJB of Java World, After reading the good

  • 0

ALL, I am a newbie for EJB of Java World, After reading the good book named Ejb3.0 in Action, I have a question about Session Bean. What is the EJB Client for a session bean? Say we have some code looks like below.

//EJB definition
import javax.ejb.Remote;
@Remote
public interface PlaceOrder {
  ..
  void addItem(Long itemId);
  Long confirmOrder(); 
  ..
}

@Stateful
public class PlaceOrderBean implements PlaceOrder {
  private List<Long> items;
  public PlaceOrderBean () {
    items = new ArrayList<Long>();
  }

  public void addItem(Long itemId) {
    items.add(itemId);
  }

  @Remove
  public Long confirmOrder() {
    Order order = new Order();
    ...
    return order.getOrderId();
  }
}


//Client 
import javax.ejb.EJB;
public class PlaceOrderTestClient {
  @EJB
  private static PlaceOrder placeOrder1;
  @EJB
  private static PlaceOrder placeOrder2;
  public static void main(String [] args) throws Exception {
    System.out.println("Exercising PlaceOrder EJB...");
    placeOrder1.addItem(new Long(200));
    placeOrder1.addItem(new Long(201));

    Long orderId = placeOrder1.confirmOrder();
    System.out.println("Order confirmation number: " + orderId);
  }
}

Updated

The EJB Client means placeOrder1 and placeOrder2 or the main application ? Does it means multiple EJB clients? Another question is what if it is in Servlet instead of main method ? thanks.

  • 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-18T08:41:54+00:00Added an answer on June 18, 2026 at 8:41 am

    EJBClient is a local program which can call and operate Remote Bean

    Here, in your scenario whatever triggers the PlaceOrderBean is a client

    InCase of Servlet, if Servlet calls the EJB it is technically client but often called Facade

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

Sidebar

Related Questions

I am newbie to EJB's. From all the reading and searching I have done
Iam newbie in Android development, and I have one stupid question. Is all pretty
This question will sound like a newbie but i have gone through all threads
Hey all, this is a newbie ASP.NET MVC question. I have a view that
dear all.i newbie at web programming and until now i still have learn about
I am a newbie and I have covered all the basic concepts of Java.
Slight newbie question. I have a base class for payments. All share the same
Newbie Java question - On all the posts for Auto Scaling the Text view,
Super-newbie question! I've been looking for a list of all the classes that come
Dear All, please help me since I'm newbie in SQL Server. I have a

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.