This chapter has shown a way to write pure SQL without having to deal with the low level cursor and connection management. This removes a lot of boiler plate and error handling that is perfect for a framework to handle.
We have also explored how DatabaseTemplate
and ORMs can work together to make persistence management easier for developers.
We took a look at mocking, and how we were able to get inside the querying process to verify that the right method calls were being made. Then we stepped back and considered how much testing is enough.
In this chapter we learned:
DatabaseTemplate
let's us get rid of query boiler plate code that gets in the way of solving use casesDatabaseTemplate
is useful for writing SQL code without dealing with cursor managementDatabaseTemplate
combined with an ORM can help us build robust applicationsIn the next chapter, we will look at augmenting our data access layer with non-invasive transactions.