Replace Spring 3.1 JDBC Framework's Deprecated Classes
Introduction
The Spring JDBC framework is used in Java applications instead of traditional JDBC to overcome several JDBC limitations. With the release of Spring 3.1, several classes used in the Spring JDBC framework are deprecated. I updated my Spring JDBC example application to use Spring 3.1 and replaced the deprecated classes with the new versions.
Example Application
Download the new example application. The example project was created using Eclipse and Maven. After unzipping the download, see the README.txt file for information on how to build and run the project.It is a standard Maven project that you should be able to import into any Maven aware IDE.
The example application uses an embedded database so there is no need to setup a database to run the application or its tests.
Deprecated Classes
The class PersonDaoImplDB demonstrates how to use the features of Spring JDBC to interact with a database. Previously the this class extended SimpleJdbcDaoSupport. With Spring 3.1, that class is deprecated. Instead PersonDaoImplDB extends JdbcDaoSupport.
SimpleJdbcDaoSupport has a method getSimpleJdbcTemplate. When changing to extend from JdbcDaoSupport, you'll also need to change from calling getSimpleJdbcTemplate to calling method getJdbcTemplate.
If you want to use the named parameters feature of Spring JDBC, then instead of extending JdbcDaoSupport you should extend NamedParameterJdbcDaoSupport. This class includes a method that gets a NamedParameterJdbcTemplate.
There are no comments for this entry.
[Add Comment]