Issue
This might be a very general question. I want to know if caching (first level cache and second level cache) is this the only way to reduce the number of db hits in Hibernate.
Solution
Your question is very generic, however at a high level yes caching will solve multiple database hit problem. You can use hibernate caching also you can also use Spring Cache Abstraction for a fine grained implementation. There are other aspects also and that depends on your problem statement and solution approach.
Remember: Any caching will increase your memory uses in application and also you need to clean cache appropriately to avoid any stale information being used.
Answered By - Shailesh Chandra
Answer Checked By - David Goodson (JavaFixing Volunteer)