Recently, we looked at different ways to implement a thread-safe “lazily initializing” singleton in Java.
The simplest way approach is with ‘synchronized’ — but there were several other suggestions, some right, and some not-so-right (double checked locking).
One approach however, was 25 times faster..
In a recent role, I introduced Hibernate into an existing multi-tenant application. This required integrating Hibernate with an existing (custom) multi-tenant structure.
Hibernate – as standard – knows nothing about tenancies. So how can we accomplish such a task? Continue reading
Logging frameworks have become a standard part of projects, since Servlets and Log4J first emerged. But how should we log? Are we getting the most we can from it?
Many developers see logging & debugging as separate tasks. When confronted with a problem we set breakpoints, step through, inspect variables, and trace through loops – often finishing hours later..
Finding problems this way is hard. Does it have to be so difficult? Could there be a way to get right to the problem area, in just minutes? Sometimes without even needing to step through? Continue reading
Users often enter data approximately or inaccurately.. But sometimes, we need to search or match this inaccurate data anyway!
For example, users should match existing customer records rather than creating unwanted duplicates.
There are standard algorithms for measuring string-distances, but we’ll need a few extra steps to make this work efficiently against a database.. Continue reading
Recently, a poster on StackOverflow asked how to design the “perfect” JPA entity.
He had been working with Hibernate for some time, but still found himself struggling with questions as property type & accessibility, immutable properties, and equals/hashCode implementation.
So here are some answers.