Please enable JavaScript.
Coggle requires JavaScript to display documents.
JPA Hibernate (Mappings (Many to Many, Many to One, One to One,…
JPA Hibernate
Mappings
Many to Many
Many to One
One to One
Embeddable
Inheritance
Table per class
Pro
:
One table created per class
Union of two tables performed.
Cons
:
Duplication of data occurs.
Joined
Pro
:
Separate table for class and sub-classes.
Good data consistency.
Cons
:
Joins will be complex and can cause performance lag.
Mapped super class
Pro
:
One table created per class
Union of two tables performed.
Cons
:
Separate table for class and sub-classes.
Good data consistency.
Single Table
Pro
:
Since all the data is stored in a single table the fetch performance is good.
Cons
:
Data consistence will not be good. Since subclass fields will be null for other classes.
Isolation Levels
READ UNCOMMITTED
READ COMMITTED
REPEATABLE READ
SERIALIZABLE
Testing
Dirties Context
Transactional
JPA Entity Life Cycle Methods
@ PrePersist/@ PostPersist
@ PreRemove/@ PostRemove
@ PreUpdate/@ PostUpdate
@ PostLoad
Enums with JPA
Performance Tuning
Caching
Eager vs Lazy Fetch
Avoid N+1 Problems
Soft Delete