How does Hibernate READ_ONLY CacheConcurrencyStrategy work
Introduction As I previously explained, enterprise caching requires diligence. Because data is duplicated between the database (system of record) and the caching layer, we need to make sure the two separate data sources don’t drift apart. If the cached data is immutable (neither the database nor the cache is able to modify it), we can safely cache it without worrying about any consistency issues. Read-only data is always a good candidate for application-level caching, improving read performance without having to relax consistency guarantees.
A beginner’s guide to Cache synchronization strategies
Introduction A system of record is the authoritative data source when information is scattered among various data providers. When we introduce a caching solution, we automatically duplicate our data. To avoid inconsistent reads and data integrity issues, it’s very important to synchronize the database and the cache (whenever a change occurs in the system). There are various ways to keep the cache and the underlying database in sync and this article will present some of the most common cache synchronization strategies.
Things to consider before jumping to application-level caching
Introduction Relational database transactions are ACID and the strong consistency model simplifies application development. Because enabling Hibernate caching is one configuration away, it’s very appealing to turn to caching whenever the data access layer starts showing performance issues. Adding a caching layer can indeed improve application performance, but it has its price and you need to be aware of it.
How does Hibernate store second-level cache entries
Introduction The benefit of using a database access abstraction layer is that caching can be implemented transparently, without leaking into the business logic code. Hibernate Persistence Context acts as a transactional write-behind cache, translating entity state transitions into DML statements. The Persistence Context acts as a logical transaction storage, and each Entity instance can have at-most one managed reference. No matter how many times we try to load the same Entity, the Hibernate Session will always return the same object reference. This behavior is generally depicted as the first-level cache. The Hibernate… Read More
JDBC Statement fetchSize property
Introduction In this article, we are going to see how the JDBC Statement fetchSize property works when using Oracle, SQL Server, PostgreSQL, or MySQL. JDBC ResultSet fetching The JDBC ResultSet offers a client-side cursor for fetching the current statement return data. When the statement gets executed, the result must be transferred from the database cursor to the client-side one. This operation can either be done at once or on demand.