A JavaBean is java class conforming to the below convention.
A bean is an Java Object that:
- is serializable,
- has a nullary constructor,
- has public properties,
- allows access to this properties using public getter and setter methods.
They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects.
There is no special class that has to be extended to create a bean.
In a database environment, the 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.
JavaBeans components are typically use to manage the data flow between an application client or applet and components running on the J2EE server or between server components and a database.