Chapter 6. Bean/Entity Synchronization: Being an Entity Bean

image with no caption

Entity beans are actors. As long as they’re alive, they’re either in the pool or they’re being somebody. Somebody from the underlying persistent store. In other words, an entity from the database. When a bean is playing a part, the bean and the underlying entity have to stay in sync. Imagine the horror if the bean is pretending to be, say, Audrey Leone, and someone lowers Audrey’s credit limit in the database... but forgets to tell the bean. The bean, acting as Audrey, is happily authorizing purchases for more than Audrey’s current limit. Or what if a client uses the bean to modify Audrey’s address, but the bean hangs on to the new info without telling the database... yikes!

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.