Book Image

Java EE 5 Development with NetBeans 6

Book Image

Java EE 5 Development with NetBeans 6

Overview of this book

Table of Contents (17 chapters)
Java EE 5 Development with NetBeans 6
Credits
About the Author
About the Reviewers
Preface
Identifying Performance Issues with NetBeans Profiler

Creating Our First JPA Entity


JPA entities are Java classes whose fields are persisted to a database by the JPA API. JPA entities are Plain Old Java Objects (POJOs), as such, they don't need to extend any specific parent class or implement any specific interface. A Java class is designated as a JPA entity by decorating it with the @Entity annotation.

In order to create and test our first JPA entity, we will be creating a new web application using the JavaServer Faces framework. In this example we will name our application jpaweb. As with all of our examples, we will be using the bundled GlassFish application server.

Note

Consult Chapter 4 Developing Web Applications using JavaServer Faces for instructions on creating a new JSF project.

To create a new JPA Entity, we need to right-click on the project and select New | Entity Class.

After doing so, NetBeans presents the New Entity Class wizard.

At this point, we should specify the values for the Class Name and Package fields (Customer and com.ensode...