As we can see, the procedure to establish one-to-one relationships is very similar to
the procedure used to establish one-to-many and many-to-many relationships.
Once we have generated JPA entities from a database, we need to write additional
code that contains the business and presentation logic. Alternatively, we can use
NetBeans to generate code for these two layers.
Generating JSF applications from
One very nice feature of NetBeans is that it allows us to generate JSF applications
that will perform Create, Read, Update, and Delete (CRUD) operations from existing
JPA entities. This feature, combined with the ability to create JPA entities from an
existing database schema as described in the previous section, allows us to write web
applications that interact with a database in record time.
To generate JSF pages from existing JPA entities, we need to right-click on File , select
New File , select the JavaServer Faces category, and then select the JSF Pages from
Entity Classes file type.
In order to be able to generate JSF pages from existing JPA entities,
the current project must be a Web Application project.