Java Reference
In-Depth Information
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 on
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;
//imports removed for brevity
@Entity
@Table(name = "CUSTOMER")
@NamedQueries({
@NamedQuery(name = "Customer.findAll",
query = "SELECT c FROM Customer c"),