New Entity Classes from Database Wizard: Mapping Options
See Also
This wizard generates a set of entity classes from an existing database connection or schema.
The IDE generates an entity class for each related table with persistent fields.
The wizard takes you through the steps of choosing the database connection or schema,
and then selecting the tables in the database that will be used to generate the entity classes.
You open the wizard by right-clicking a
project node or subnode and choosing New > Other, selecting the Persistence category and then selecting Entity Classes from Database.
In this page of the wizard you can set the following options for configuring
generated annotation elements:
- Association Fetch. Select the fetch element to add to the relationship annotations.
You can select default, eager or lazy.
When default is selected (default is selected by default),
no fetch element is added to the relationship annotations.
- Collection Type. Select the collection type for OneToMany and ManyToMany CMR fields.
You can select java.util.Collection, java.util.List or java.util.Set.
java.util.Collection is selected by default.
- Fully Qualified Database Table Names. When selected, catalog and schema
elements are added to the @Table annotation.
This option is deselected by default.
- Attributes for Regenerating Database Tables. When selected, nullable (when it is false),
length (for String type), precision and scale (for decimal type) are added
to the @Column annotation.
Unique constraints are also added to the @Table annotation when selected.
This option is deselected by default.
When you click Finish, the IDE creates entity classes for each of the tables you specified in the wizard.
- See Also
- About Java Persistence
- Generating Persistent Entity Classes from a Database
- Creating a Persistence Unit
Legal Notices