spring JDBC OO fashion
Posted on 2011-05-06
I was reading folowing lines and I did not understand clearly.
writing JDBC code in a much
cleaner fashion. But the code was still tightly coupled to SQL. This is not necessarily
a bad thing. But what if we want to write JDBC code in a more OO fashion?
Spring provides a way to actually model database operations as objects. This adds
another layer of insulation between your code and straight JDBC.
Spring provides classes for both reading and writing data. As we work through
some examples of these, there are a couple of things you should know. First, these
database operation objects are thread-safe, meaning you need to create only one
instance per database operation. Second, any database operation object must be
compiled before being used. This lets the object know when to prepare the statement
so that it can be executed later. Not surprisingly, you compile a database operation
object by calling the compile() method. We will demonstrate this practice in
To start off, let’s see how we would create an object to write data to
Any ideas, resources,sample code,links, highly appreciated. thanks in advance.