TL;DR version: Don’t implement
equals() on mutable objects.
This is a post I’ve been tossing around for a couple of years, ever since a lunchtime debate with a colleague. It’s a simple statement: You shouldn’t implement the
equals() method if your object isn’t immutable.1
Continue reading “Java, Equality, Mutability”
Hibernate has long had a feature known as “query caches” – you can run a query, cache the result, and thus avoid running it repeatedly. The only problem is that it doesn’t do what you think it does.
Continue reading “Hibernate Query (Lack Of) Caching”
At work, we are a heavy user of ehcache. Well, we would be… it was initially written at Wotif, to overcome problems with the Jakarta JCS project. I recently had to sit down and figure out exactly how it works, and thought I’d take a moment to write it up.
*Update*: I tested the Hibernate serialization behaviour. See below for more.
Continue reading “ehcache dissected”
In Hibernate 2, you could sort-of do a bulk delete via the
Session interface. In Hibernate 3, they have true bulk deletes, ala Section 3.11 of the EJB 3 Persistence API. However, they have some significant differences which people migrating to the new functionality need to be aware of.
Continue reading “Differences in behaviour between Hibernate delete queries and the old way”
I finally got a chance to try out upgrading to Hibernate 3 at work. It wasn’t the smoothest of rides, but I got there in the end.
Continue reading “Upgrading to Hibernate 3 – a war story”
When I gave my talk on Monday I’d sort of hurried over the new bulk queries in Hibernate, largely because I didn’t have much luck finding doco on them.
Now I know how they work.
Continue reading “How the new Hibernate bulk queries work”
I’d introduced a Hibernate user type into the code base a few days ago. I’d based it on an example in the (more or less) wonderful book Hibernate in Action Naturally, however, I’d copied the example with a bug in it!
Continue reading “Remember to read the errata!”
A while back, I blogged about how Hibernate named queries rock I found another reason why they rock today: it lets you hide what your persistent properties are called.
Continue reading “Another good use for named queries”