Introduction
The Java Persistence API (JPA) is a specification that has been produced in different releases from 2006 (JPA 1.0) to 2013 (JPA 2.1) by a group of various experts. Historically, it is one of the three pieces of the EJB 3.0 specification, which has come along with JEE5.
More than an upgrade of Enterprise JavaBeans (EJB), JPA was pretty much a complete redesign. At the time, the leading providers of Object Relational Mapping solution (such as Hibernate) and of J2EE application servers (such as WebSphere, JBoss) have been involved, and the global result has been unarguably simpler. All the types of EJBs (stateful, stateless, and entities) are now simple Plain Old Java Objects (POJOs) that are enriched with specific metadata that is nicely presented as annotations.
The Entities' benefits
Entities play a key role in the EJB3 model. As simple POJOs, they can be used in every single layer of the application.
Ideally, an entity represents an identifiable functional unit within a...