Please enable JavaScript.
Coggle requires JavaScript to display documents.
Problem: How persist objects to a database? (Relational Database (Convert…
Problem: How persist objects to a database?
Relational Database
Simply use scalar values other than objects
Convert objects to a group of scalar values
Object-Oriented Mappings(ORM)
Pros: reduce the amount of code that needs to be written
Cons: High level of abstraction obscuring what is actually happening in the implementation code.
Java Persistence API(JPA)
Definition: Java
specification
for accessing, persisting, and managing data between Java objects / classes and a relational database
Impact: Considered the standard industry approach for Object to Relational Mapping (ORM) in Industry.
Implementations
Hibernate
Ref 1:
https://www.zhihu.com/question/52663293
Ref 2:
https://www.linkedin.com/pulse/how-hibernate-almost-ruined-my-career-kishan-kumar/
Object-relational impedance mismatch
Granularity 2. Inheritance 3. Identity 4. Associations 5. Data navigation (
Reference
)
Document-Oriented Database
Object-Document Mappers(
ODM
)
Typically XML or JSON
Main Category of
NoSQL
database
Data Access Object(
DAO
) Pattern
An object that provides an abstract interface to some type of database or other persistence mechanism. This isolation supports the
Single responsibility principle
.
Changing business logic can rely on the same DAO interface, while changes to persistence logic do not affect DAO clients as long as the interface remains correctly implemented