Java Reference
In-Depth Information
We need to enter a name, fully qualified name, and scope for our managed bean
(which, in our case, is our DAO), then click on the
Add
button.
This action results in our DAO being declared as a managed bean in our application's
faces-config.xml
configuration file.
<managed-bean>
<managed-bean-name>CustomerDAO</managed-bean-name>
<managed-bean-class>
com.ensode.jpaweb.CustomerDAO
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
We could at this point start writing our JPA code manually, but with NetBeans there
is no need to do so, we can simply right-click on our code and select
Persistence |
Use Entity Manager
, and most of the work is automatically done for us.