Java Reference
In-Depth Information
At this point we can either select an existing data source, or, like we did in the
previous example, create one "on the ly". In our example we created a new one, then
selected the database connection we created earlier in this section.
Once we have created or selected our data source, we need to select one or more
tables to use to generate our JPA entities. If we wish to create JPA entities for all
tables, we can simply click on the Add All>> button.
After clicking Next> , NetBeans gives us the opportunity to change the names of the
generated classes, although the defaults tend to be sensible. We should also specify
a package for our classes, and it is a good idea to check the Generate Named Query
Annotations for Persistent Fields checkbox.
Named Queries are explained in detail in the next subsection.
In the next screen in the wizard, we can select how associated entities will be fetched
(eagerly or lazily). By default, the default behavior is selected, which is to fetch
"one-to-one" and "many-to-one" relationships eagerly, and "one-to-many" and
"many-to-many" relationships lazily.
 
Search WWH ::




Custom Search