The gateway object is a great way to separate your database calls into a container that could be easily swapped out in the event that you change to a different database setup and to make things a little more distinct and easier to understand when coding.
Assuming you follow the philosophy of the MVC frameworks out there, you’ve likely come across Beans, Services, DAOs (data access objects), and Gateways. Without getting too much into detail about what each of these types of components do, which I’ll get into in a future blog post, your gateway layer is meant to interact with your database where you need to do more than just create, read, update, or delete objects (which is what a DAO is for).
