Creating a Java Persistent Entity |
This quick start shows how to create a new Java persistence entities. We will create an entity to associate with a database table.
Right-click the project in the Package Explorer and select New > Other. The Select a Wizard dialog appears.
In the Select a Wizard dialog, select Java Persistence > Entity and click Next. The Java Class page of the Create New Entity wizard appears.
On the Java Class page, enter a package name (such as quickstart.demo.model
), class name (such as Address
), and click Next. The Java Persistence Entity page of the Create New Java Persistence Entity wizard appears.
Eclipse adds the new entity to the project and adds the @Entity
annotation to the class.
After creating the entity, you must associate it with a database table.
Select the Address class in the Explorer view.
In the Persistence Properties view, notice that Dali has automatically associated the ADDRESS database table with the entity because they are named identically.
Now that you have created a persistent entity, you can continue with Mapping an Entity to map the entity's fields to columns on the database table.