You have already noticed that FarmServlet is tightly coupled to the FarmEJBRemote instance, which was retrieved via a call to "FarmEJBUtil.getHome().create()". It makes it very hard to test. When unit testing, we don't want to use any database. We don't want to access an EJB server either. That would make unit tests both difficult to execute and slow. So in order to unit test the FarmServlet class smoothly, we'd better make it loosely coupled. To remove the tight dependency between FarmServlet and FarmEJBRemote, we could use a setter based injection:
In the second one, it still depends on FarmEJBRemote, doesn't it?