Pages

Entities and Value Type object in Hibernate

Entities and Value Type object in Hibernate


Entity type objects has its own life cycle, object reference of an entity type is stored as a reference (as a foreign key value) in the database. Entity object has its own database identity. It can have shared references with the other entity type object. Its may exist independently of any other entity.

Values type object do not have life cycle, it belongs to entity type object and its persisted state is stored in the table row of same entity type object. Value type object do not have identity value or identifier properties. Life of a value type object is bounded by its lifespan of owning entity type object. Values type object do not have shared references. Values type object are like String class , Integer class etc. User Type class can also be mapped as a value types. 

1 comment: