JavaOmnibus
J2EE Session Facade
J2EE pattern • Business
J2EEBusinessJava example

Session Facade solves a specific structural problem in the design.

Expose coarse-grained business operations to reduce chatty calls.

Pattern overview

J2EE pattern

Expose coarse-grained business operations to reduce chatty calls.

Intent

Wrap business workflows in a coarse-grained facade suited to application or remote clients.

Problem

Clients make too many fine-grained calls across boundaries, increasing chatiness and leaking workflow details.

Solution

Provide a higher-level session facade that executes the whole business use case.

Fit and tradeoffs

FamilyJ2EE
CategoryBusiness
Best used when
  • For application services, orchestration layers, or remote business APIs.
Tradeoffs
  • Can become broad if every use case is dumped into one service.

Java example

This example is intentionally compact so the pattern shape stays easy to see.

public final class BookingSessionFacade {
    private final FlightService flightService;
    private final PaymentService paymentService;

    public BookingConfirmation book(BookingRequest request) {
        Fare fare = flightService.reserve(request.flightId(), request.passengerId());
        Receipt receipt = paymentService.charge(fare.total());
        return new BookingConfirmation(fare, receipt);
    }
}

Related pages

Keep exploring