When I was working on one of our microservice projects, I’ve come up with a nice project which help us to run a Redis Server as embedded within our Java integration tests. Actually, by using such a library, it becomes very easy to start and stop a Redis server instance within the test methods. However, […]
Category: English
Redis Transactions in Spring Enabled Applications
Thanks to the Spring Data Redis project‘s “Redis Repositories” support, it is much easier to manage domain objects within Redis datastore. Redis Repositories also provides support for custom mapping and secondary indexes. Unfortunately, Redis Repositories stuff doesn’t work with “Redis Transactions”. If you want to make use of Redis Transactions and synchronize your Redis database […]
Kafka Transactions in Spring Enabled Applications
Kafka’s transactions are very suitable for scenarios that have a read-process-write pattern. It will be enough to add the following property definition in your application in order to enable Kafka transactions while you are working with Spring Boot and Kafka. When Spring Boot notices transaction-id-prefix, Spring Boot AutoConfiguration feature enables KafkaTransactionManager bean within the ApplicationContext. […]
Spring Boot & JSPs in Executable JARs
Nowadays almost everyone employ their favorite JS based framework while developing their dynamic web applications. There are dozens of client and server side UI frameworks around there, and you can be sure that you are going to be criticized about your choice it doesn’t matter which one you chose. Some will ask why it is […]
Hibernate EntityCopyObserver: What Is It Used For?
JPA merge operation is used to reconnect and synchronize detached entities with active PersistenceContext so that changes performed on them could be reflected onto the database. Due to its complex nature, there might be times when multiple representations of an entity appears in the merge process. Hibernate throws IllegalStateException in that case, because allowing each […]
EhCache Configuration in Replicated Mode
In cluster environments, you can configure EhCache in two different topologies, one is distributed, and the other is replicated. In replicated mode, each EhCache instance in the network acts as a peer. There is no master cache. Instances communicated with each other via multicast network messages through RMI. Configuration of EhCache in replicated mode is […]
Hibernate Events and Custom EventListener Registration
Since Hibernate 3, each and every operation through Session API fires one or more persistence events during the course of its execution. For example, when you invoke session.get(Foo.class,1L), in order to fetch Foo entity with PK 1, Hibernate fires events with pre-load, load and post-load event types. There is a seperate EventListener interface for each […]
How to Customize Dirty Check Mechanism of Hibernate During Flush
Hibernate needs to identify which entities in the Session has been changed, in other words become dirty in the meantime, so that it can issue an update sql statement to reflect those changes into the database. The default mechanism to identify dirty entities is to compare each attribute one by one with the snapshot kept […]
Is It Possible To Change Entity Fetch Strategy During Hibernate Merge?
When I talk with my colleague about my experience with Hibernate merge behavior on lazy associations with cascade type merge, he suggested me to check if Hibernate allows us to change fetch logic it applies on detached entities during merge operation. That way, it would be possible to suppress eager initialization of those associations during merge. Hibernate […]
More about Eager Initialization of Lazy Associations During Hibernate Merge
After reading my blog post about eager initialization of lazy 1:1 or M:1 associations because of the cascade merge attribute, someone asked about if it applies for 1:M and M:N associations as well? The answer is, yes it applies. Let’s create another small entity in order to illustrate that case as well. @Entity @Table(name=”T_BAZ”) public […]