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

The Problem

How do entity beans perform global operations that aren’t specific to any single entity instance, such as counting total accounts or calculating aggregate values across the entire database?

Core Idea

ejbHome() methods are business methods that operate on the entity bean class as a whole, not on specific entity instances. They run while the bean is still in the pool, with no specific data loaded.

How It Works

  • Client calls a home method on the home interface (e.g., getTotalBankValue())
  • Container delegates to the bean’s ejbHome<MethodName>() method
  • Method executes global SQL queries (e.g., SELECT COUNT(*) FROM accounts)
  • Method returns result to client
  • Bean remains in the pool—no specific data instance is associated

Key Properties

  • Called from Home Interface but implemented in the bean class
  • Prefix is ejbHome followed by method name
  • Runs while bean is in pool, not in ready state
  • Can perform aggregate operations across all entities

Visual Explanation

ejbHome__ A Ejbhome() Input B Ejbhome() Core Mechanism A->B triggers C Ejbhome() Output B->C produces

Semantic Network

semantic_ejbHome__ THIS Ejbhome() REL1 Related Concept THIS--REL1 related REL2 Builds Into THIS--REL2 builds into

Connections

Edge Cases & Gotchas

  • Cannot call getPrimaryKey() in home methods—bean has no identity
  • Don’t confuse with instance-specific business methods