Created
April 27, 2011 21:07
-
-
Save jgoldberg/945214 to your computer and use it in GitHub Desktop.
Creating a BaseDAO class which supports both Hibernate Template + JDBC Template + Simple JDBC Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.springframework.jdbc.core.JdbcTemplate; | |
| import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; | |
| import org.springframework.orm.hibernate3.SessionFactoryUtils; | |
| import org.springframework.orm.hibernate3.support.HibernateDaoSupport; | |
| /** | |
| * @author jgoldberg | |
| * | |
| */ | |
| public class BaseDaoImpl extends HibernateDaoSupport { | |
| public SimpleJdbcTemplate getSimpleJdbcTemplate() { | |
| return new SimpleJdbcTemplate(SessionFactoryUtils.getDataSource(getSessionFactory())); | |
| } | |
| public JdbcTemplate getJdbcTemplate() { | |
| return new JdbcTemplate(SessionFactoryUtils.getDataSource(getSessionFactory())); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment