Creating a Java persistent entity |
This quick start shows how to create a new Java entity with persistence. 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 Finish.
Eclipse adds the new entity to the project and adds the @Entity
annotation to the class.
Eclipse also displays the Address entity in the Persistence Outline view:
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.