Hibernate defines the persistent class as any classes that can be persisted to the database.
There are two types of persistent classes : entity type and value type . So entity is one type of the persistent class.
Entity type are those classes that are marked with @Entity
while value type are those classes marked with @Embeddable
or some basic Java type such as String
, Integer
, Date
etc.
The main difference between them is that value type does not define their own life-cycle.They are "owned" by entity type which defines their life-cycle.
We create an entity type class which contains many value type classes.