• ↑↓ to navigate
  • ↵ to open
  • ⟶ to select
  • ⌘ ⌥ ↵ to open in a panel
  • ←→ to navigate
  • esc to dismiss
⌘ '
keyboard shortcuts

The Problem

How do you model business processes and workflow logic in a server-side Java application that can be managed by a container and participate in transactions?

Core Idea

A session bean is a server-side component that represents work being performed for client code. It implements business logic, rules, algorithms, and workflow. Session beans are business process objects—not persistent data objects.

How It Works

  • Client code accesses session beans through the EJB container
  • The container intercepts all calls, providing middleware services (security, transactions, concurrency)
  • Session beans are non-persistent—they exist only in memory during a client session
  • When the client disconnects, the session bean can be destroyed
  • Session beans do not survive server or machine crashes

Key Properties

  • Non-persistent (in-memory only)
  • Short-lived (lifetime of client session)
  • Not shared between multiple clients
  • Can perform database operations but are not themselves persistent
  • Two subtypes: stateful and stateless

Visual Explanation

Session_Bean A Session Bean Input B Session Bean Core Mechanism A->B triggers C Session Bean Output B->C produces

Semantic Network

semantic_Session_Bean THIS Session Bean REL1 Related Concept THIS--REL1 related REL2 Builds Into THIS--REL2 builds into

Edge Cases & Gotchas

  • Session beans cannot survive application server crashes
  • If client times out, container may destroy the session bean
  • Do not rely on ejbRemove() for critical cleanup—it may never be called if container crashes