In outline, a bean is a Java class that has properties, events and methods. For each of its properties, the bean also includes accessors, that is get
and set
methods. Any object that conforms to certain basic rules can be a bean. There is no special class that has to be extended to create a bean.
In the steps for creating a sample application in this chapter, a JavaBean is used to hold a single employee record. When a user wants to edit an existing record or add a new one, it is used as a container to hold the changed or new values for a single row of a table to prepare the row for using to update the database.
The bean contains properties for each field in an employee record, and then JDeveloper creates the accessors (get
and set
methods) for each of those properties. You will see how to create a JavaBean for the sample application in the following subsections: