These are the methods you MUST mark with an attribute (for a CMT bean)

Session beans

  • Business methods in the component interface

  • NONE of the other methods the client sees in the component interface (from EJBObject or EJBLocalObject)

  • NONE of the methods in the home interface, including those written by the Bean Provider as well as those from EJBHome or EJBLocalHome

image with no caption

Entity beans

  • Business methods in the component interface

  • NONE of the other methods the client sees in the component interface (from EJBObject or EJBLocalObject) except remove()

  • ALL of the home interface methods written by the Bean Provider, as well as the remove() methods from EJBHome or EJBLocalHome.

image with no caption

Note

You have to mark more methods with an attribute when you use entity beans than you do with session beans..Remember, create() and remove() are a Big Deal to an entity (insert and delete!).

Message-driven beans

  • onMessage()

A message-driven bean doesn’t have any client interfaces.

onMessage()

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.