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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:21:01+00:00 2026-06-06T22:21:01+00:00

When I say EJB here, I mean EJB 3.x! I’m new to EJBs and

  • 0

When I say “EJB” here, I mean EJB 3.x!

I’m new to EJBs and am wondering how to best map all of my business logic to different beans. At one extreme, you could KISS and just have one monolithic EJB that has a bazillion methods that handle 100% of your app’s business logic. On the other extreme, you could partition your business logic up to the function-level (List<User> getUsersFromMars()) and have a bazillion EJBs that consist of 1 package, 1 class, and 1 method each:

Extreme #1:
    my-ejb.jar/
        com.me.myorg.MonolithicBean
            List<User> getUsersFromMars();
            List<User> getUsersFromVenus();
            //... a bazillion methods

Extreme #2:
    my-mars-ejb.jar/
        com.me.myorg.MarsBean
            List<User> getUsersFromMars();
    my-venus-ejb.jar/
        com.me.myorg.VenusBean
            List<User> getUsersFromVenus();
    //... a bazillion EJBs with 1-and-only-1 method each

Obviously, I would imagine that best practices dictate some kind of intermediary strategy between these two extremes. So I ask, what does Java/Oracle say about decomposing your app’s business logic down into beans, and how to modularize them at the correct level (EJB, package, class or method) so as to be reusable, scalable and secure?

  • 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-06T22:21:03+00:00Added an answer on June 6, 2026 at 10:21 pm

    I think this question is not really specific to EJBs, but is more about OO design, and even general design.

    An often recurring pattern is that you can split up your business logic into DAOs and Services. A DAO handles all operations related to a single (domain) entity, like Customer. It interacts only with a data source (typically a database), and has methods like save, update, delete, but also getBySomething methods. Such DAOs can typically have between 1 and ~15 methods, depending on your specific business case.

    Then you have Services that as a rule of thumb interact with more than 1 entity and/or interact with other systems (like JMS queues, Mail systems, Web Services, etc) and perform validation/provide security. These form the verbs of your business logic, and typically centralize around a specific business concept, like e.g. a Purchase. So you could have a hypothetical PurchaseService, with methods like purchaseGood, purchaseOffer, calculateReduction. Again, this would have anywhere between 1 and something like 15 or 20 methods.

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

Sidebar

Related Questions

I was wondering... Let's say that I have two stateless beans in ejb 3.1:
Here is a very strange behavior using EJB beans: @Local public interface Provider {
Let's say I want to use an EJB container and I don't know how
Why do people say that business logics should be implemented on the server side
I have understood that if I use EJB in Spring context, I get all
Let's say I have two ear file and one .jar file with an EJB
Let us say I am trying to list all products using a restful interface.
I am newbie to EJB's. From all the reading and searching I have done
Say we have the following method: private MyObject foo = new MyObject(); // and
Technologies: Jave EE, Weblogic 10.3, JMS Scenario: An EJB module, say Module_1, with 3

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.