Java Reference
In-Depth Information
The EJB 3.0 entity bean generated from the EJB 2.0 entity bean is listed below. First,
the import statements are specified.
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.ManyToOne;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
The @Entity annotation specifies the class to be an entity class. And, the @Table
annotation specifies the table name.
@Entity
@Table(name="Catalog")
The named queries are grouped with the
@NamedQueries
annotation and each
named query is specified with the
@NamedQuery
annotation. The
name
attribute
specifies the named query name that may be used with
EntityManager
when
creating query objects. The
query
attribute specifies the query string in the Java
Persistence query language.
Search WWH ::
Custom Search