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 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.