It is consistent. Equal objects -> same hashcode. We could include uid in equals() as well. Point is: it must not be the only equals criterium.