In Java EE 5 applications, you use entity classes to create persistent entity objects ("entities"). Entity classes are "plain old Java objects" (POJOs). Entity classes import the Java persistence library javax.persistence.Entity and are marked with the @Entity annotation in your source code.
To create an entity class:
When you click Finish, the IDE generates the entity class and opens the class in the Source Editor. Annotations in the entity class define the primary key and the primary key generation strategy for the entity.
Entities have the following characteristics:
In Java EE 5 applications, entities created using entity classes share many of the characteristics of entity beans in J2EE applications. Unlike entity beans, entity classes are not restricted to EJB modules in enterprise applications. Entity classes can be located in an EJB module or a web module. Entity classes can also be used in Java SE applications.
When coding entity classes, you use annotations to map entities and entity relationships to a database. You do not need to use external XML descriptor files to map persistent objects to a database. The information about the data source is contained in a persistence unit.