 <p>You shouldn't be mocking at that level. Basically the idea is that you have interfaces that acts as a facade on database and ORM operations.</p> <pre><code>interface IFetchUsers { UserList GetAll(); User GetById(int id); } interface ICalculateDebt { float GetDebt(int accountId); } interface IPersistOrder { void Save(Order order); } </code></pre> <p>(forgive syntax errors, it's been a long time since I've done Java.)</p> <p>These are injected via the constructor into your other classes and become trivial to <a href="http://martinfowler.com/articles/mocksArentStubs.html" rel="nofollow">mock, or even stub</a>.</p> <p>Then, for actual db code you just implement these interfaces. You can even put all implementations in a single class.</p> <p>And that's it. No need to get fancy, but if you do want to get into fancier versions of this look into the repository design pattern (though I would argue that its not really necessary if using a good ORM).</p>