# Entity

An Entity is a persistent domain object.

An entity can be:

- Abstract or concrete classes. Entities may also extend non-entity classes as well as entity classes, and non-entity classes may extend entity classes.

An entity must have:

- A no-arg constructor (public or protected); the entity class may have other constructors as well.

Each persistent entity must be mapped to a database table and contain a primary key. Persistent entities are identified by the `@Entity` annotation.

Use this procedure to add persistence to an existing entity:

1. Open the Java class in the Project Explorer.

2. Select the class in the JPA Structure view.

3. In the JPA Details view, click the mapping type hyperlink to access the Mapping Type Selection dialog. In the following figure, clicking entity invokes the dialog from the JPA Details View.

   The Mapping Type Hyperlink

   Tip: You can also change (or add) persistence for an entity by right-clicking the class in the JPA Structure View and then clicking Map As > Entity.

4. Select Entity from the Mapping Type Selection dialog and then click OK.

   The Mapping Type Selection Dialog

5. Complete the remaining JPA Details view (for entities).

Related reference

- Adding persistence to a class

- Specifying additional tables

- Specifying entity inheritance