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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:24:44+00:00 2026-06-06T17:24:44+00:00

im programming a project and im trying to apply multitier architecture. Right now ive

  • 0

im programming a project and im trying to apply multitier architecture.
Right now ive got 2 EJB, business and persistence and a shared jar. Due a funcional requirment, persistence must be replaceable. I made an Interface called IPersistence.
Then I crated a remote session bean called “persistence” inside the persistence EJB and put the remote interface in the shared library. Now, i need to call an IPersitence using injection from the business. How can i do that? Maybe the whole idea is wrong. I need some advice.

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-06T17:24:46+00:00Added an answer on June 6, 2026 at 5:24 pm

    Here is a simple example where you have a car repository/DAO that abstracts the persistence from the business logic by not exposing if it is stored in a database, file, XML etc. The business class then injects an instance to be able to – in this case – save to an database. However you could have made other classes that implemented the CarRepository and provide other means for saving data in your application without touching other parts of your code.

    Persistence layer

    Interface for the repository/DAO

    @Local
    public interface CarRepository {
        List<Car> findAllCars();
    
        // Many other methods
    }
    

    Repository (Domain driven design) or Data Access Object

    @Stateless
    public class CarSqlRepository implements CarRepository {
    
        @PersistenceContext(unitName = "MyUnit")
        private EntityManager entityManager;
    
        public List<Car> findAllCars() {
    
        }
    
        // Many other methods
    }
    

    Service/business layer

    @Stateless
    public class CarService {
    
        @Inject
        private CarRepository carRepository;
    
        public List<Car> findAllCars() {
            return carRepository.findAllCars();   
        }
    
        // Many other methods
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to iPhone programming and I'm trying to use CHDataStructures in my project.
I recently diverged from business application programming to trying my hand (just as a
Can someone help me out please...I'm trying to start my first programming project. It
Programming Student here...trying to work on a project but I'm stuck. The project is
I'm making my first Java project, and trying to learn OO programming as well
For a class project I'm trying to do some socket programming Python but running
I'm trying to use Word 2010 to create a template for a programming project
I've been trying to learn flex/flash programming and am working on a project where
I do have experience with Ruby on Rails, and am programming a project in
I'm programming a BinaryTree project. I finished all (insert, delete, create, find) but one

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.