Loading Types

Eager – initialization occurs on spot.

Lazy – defers initialization as long as possible.

Cascade Types

ALL – propagates all operations.

PERSIST – propagates persist operation.

MERGE – propagates merge operation.

REMOVE – propagates remove.

REFRESH – propagates refresh and reload of children elements.

DETACH – propagates detachment to children elements.

LOCK – propagates reattachment for children in persistence context.

Mapping types


Persist vs Merge

persist – to add totally new entities

merge – to put back into persistence context if the entity was detached and changed.

Detached object, is an object that has been persisted but then it’s session has been closed.