Java Reference
In-Depth Information
Additionally, we can select what collection type to use for the "many" side of a
"one-to-many" or "many-to-many" relationship. The default value is java.util.
Collection . Other valid values are java.util.List and java.util.Set .
Checking the Fully Qualified Database Table Names checkbox results in adding the
catalog and schema elements of the table being mapped to the @Table annotation for
each generated entity.
Checking the Attributes for Regenerating Tables results in the generated @Column
annotations having attributes such as length , which specifies the maximum length
allowed in the column; nullable , which specifies if null values are allowed in the
column; precision and scale , which specify the precision and scale of decimal
values, respectively. Checking this attribute also adds the uniqueConstraints
attribute to the generated @Table annotation to specify any unique constraints
that apply to the table, if necessary. When clicking Finish , NetBeans generates
JPA entities for all tables in the database. Our database contained a table named
CUSTOMER table. Let's take a look at the generated Customer JPA entity.
package com.ensode.jpa;
//Import statements removed for brevity.
@Entity
@Table(name = "CUSTOMER")
@NamedQueries({@NamedQuery(name = "Customer.findByCustomerId",
 
Search WWH ::




Custom Search