Creating an Entity Bean with Bean-Managed Persistence

An entity bean looks just like a session bean in that you still create Home and Remote interfaces as well as an implementation class. One of the differences is that the Home interface can have finder methods, remove methods, and other utility methods. The other difference is that the implementation class must have several methods that a session bean doesn't need.

As with the session bean, it's best to start by creating the Home and Remote interfaces, because if you can't define these, you don't know yet what the bean is supposed to do. Suppose you want to create a simple address book application. You can store the name, address, and phone number of each person by creating a Person entity bean. ...

Get Special Edition Using Java™ 2 Enterprise Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.