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

The Problem

How does an entity bean persist its modified in-memory state back to the database? How does the container know when to flush changes?

Core Idea

ejbStore() is a container callback that synchronizes the bean’s in-memory field values to the database. The bean writes an UPDATE query to persist changes.

How It Works

  • Container calls ejbStore() typically at transaction commit or before passivation
  • Bean already has the data in memory, so no need to call getPrimaryKey()
  • Bean acquires JDBC connection
  • Bean executes UPDATE query to persist field values
  • Unlike ejbLoad(), bean knows its identity from in-memory fields

Key Properties

  • Called during transaction commit or before passivation
  • In BMP: developer writes the UPDATE logic
  • In CMP: container auto-generates the UPDATE
  • No need to call getPrimaryKey() since data is in memory

Visual Explanation

ejbStore__ A Ejbstore() Input B Ejbstore() Core Mechanism A->B triggers C Ejbstore() Output B->C produces

Semantic Network

semantic_ejbStore__ THIS Ejbstore() REL1 Related Concept THIS--REL1 related REL2 Builds Into THIS--REL2 builds into

Connections

Edge Cases & Gotchas

  • Called by container, not by client directly
  • Don’t confuse with ejbPassivate() which releases resources, not saves data