Java Reference
In-Depth Information
In the Summary Page click on Finish . The entity bean class model.Catalog gets
created. The persistence.xml deployment descriptor gets created in the
META-INF directory.
The Entity class
The entity bean class is just a POJO class annotated with the @Entity annotation. A
@NamedQuery specifies a findAll query, which selects all the entity instances. An
entity bean, which is persisted to a database and has caching enabled, is serialized
by caches. Therefore, the entity bean class implements the java.io.Serializable
interface. Specify a serialVersionUID variable, which is used by serialization
runtime to associate a version number with the serializable class:
private static final long serialVersionUID = 7422574264557894633L;
The database columns are mapped to entity bean properties, which are defined as
private variables. The getter setter methods for the properties are also defined. The
identifier property is specified with the @Id annotation. The @Column annotation
specifies that the id column is not nullable:
@Id
@Column(nullable = false)
private long id;
 
Search WWH ::




Custom Search