Java Reference
In-Depth Information
In the Entity Properties window, the Entity Name , Table Name , and Entity Fields
are specified. Entity fields may be added with the Add button. Click on Finish . An
EJB 3.0 entity bean class gets added to the JPA project. The Entity class Catalog is
shown with code, which we shall discuss next:
The EJB 3.0 entity class
Unlike EJB 2.0, in EJB 3.0 entity beans are Plain Old Java Objects (POJOs). Entity
bean mappings are defined using annotations, which were introduced in JDK 5.0 and
are in the javax.persistence package. A POJO class annotated with the @Entity
annotation is an entity bean. The schema and table for the entity bean mapping is
set at the class level using the @Table annotation. If the @Table annotation is not
specified, the default table name is the entity bean class name. We shall create an
entity bean Catalog that is mapped to Catalog table:
public class Catalog implements Serializable {
Search WWH ::

Custom Search