r/javahelp • u/kurular4 • Dec 09 '20
Should I really learn hibernate?
I am core java developer and had internship before using Spring boot to create rest api. I am also developing my own projects using boot and I really never had to know about Hibernate because Spring perfectly abstract database operations via JPA and we can handle every database operations without knowing what is in the background. So, should I really need to learn hibernate?
Can you give me scenarios where I should know about hibernate using Spring boot?
19
Upvotes
1
u/LiteratureStriking Dec 09 '20
No, I am not saying that.
I am saying that it isn't trivial and would require rethinking the system design, for example migrating the system design to CQRS. Many applications might start off without separate read models and write models or clear separation between commands and queries, which would require analysis about the data flow of the entire system. This is entirely doable, but not at all trivial.
You might end up pushing JPA into the write model (since the session deals with tracking mutation), and push native queries to the read model (or views or materialized views on the DB) or to non-relational stores like Cassandra (with some machinery in the middle to keep the data stores in sync).