Maven dependencies used all over JPA tutorials same. Please follow "Setting up Project" section to understand about project configuration.
persistence.xml and other code files reused from How to Persist an Entity in data base using JPA?
Each Sample application from download includes SQL file also.
Big Picture of Entity types vs Value Types :
Entity Types :
If an object has its own database identity (primary key value) then it’s type is Entity Type.
An entity has its own lifecycle. It may exist independently of any other entity.
An object reference to an entity instance is persisted as a reference in the database (a foreign key value).
From the above picture, College is an Entity Type. It has it’s own database identity (It has primary key).
Value Types :
If an object don’t have its own database identity (no primary key value) then it’s type is Value Type.
Value Type object belongs to an Entity Type Object.
It’s embedded in the owning entity and it represents the table column in the database.
The lifespan of a value type instance is bounded by the lifespan of the owning entity instance.
Basic, Composite, Collection Value Types :
Basic Value Types :
Basic value types are : they map a single database value (column) to a single, non-aggregated Java type.
Hibernate provides a number of built-in basic types.
String, Character, Boolean, Integer, Long, Byte, … etc.