I’m learning JPA/Hibernate and I got to wondering: is ormapping a subset of persistence, is it the other way around, or are they (theoretically) two separate concerns?
It seems that, at least in the context of Java, one cannot have persistence if an ormapping mechanism does not exist; so my initial thought was that ormapping is a subset of persistence. If so, what other concerns besides ormapping does JPA (and persistence in general) address? If not, can someone explain the relationship between these concepts?
Thanks in advance.
You can have persistence without ormapping, though you can’t have ormapping without persistence. For example, you can accomplish persistence through JDBC API calls. It’s a bit more tedious, but your data is still saved into a database.
Ormapping frameworks also address / have
Local caching of data from the database to reduce database query trips
Making sure that stale data does not get written to a database table
Allows developers to query the data model in an object-oriented fashion