Skip to content

Notes from the bench

Waiting for transaction propagation

In the land of traditional ACID DBs, I often encounter code that is trying to collaborate with some external system using a queue or notification system. The problem is that it ends up sending the notification to the external system before the data has been committed to the central database. Then when the external system tries to query for data based on the notification, the data is not there yet (a different or outside a transaction).

Generic API documenter for web-services

For some time I have meant to fully document all the different APIs I’m involved in. It gives a more professional feel, it helps integrators and front-end developers and it actually makes it easier to spot inconsistencies in naming or configuration.

EclipseLink needs to change your entity classes to do lazy loading and change tracking properly. It can do that when the application starts. That sounds convenient. It has been a pain in the neck on every server I have set it up on.

Spring DefaultKeyGenerator gotcha

To speed things up I had applied the excellent @Cacheable annotation to a service method in our application (don’t miss the excellent performance analysis here, btw). However, I had not paid too much attention to the parameters going into the cache key. I would have expected something like concatenated toString() or something similar, however the default is to use the hashCode() of each parameter and create another (32-bit) hash code. Obviously this can easily generate collisions, as we shall soon see.