19

I am new to Spring 3.0 . For DAO access i have choosen SpringJDBC. SpringJDBC provides JDBC Template and SimpleJDBCTemplate . Which one is best. I read in some of the forum SimpleJDBCTemplate going to be deprecated in Spring 3.1. What is the difference between these two.Guide me which one is best.

Mohan
  • 3,893
  • 9
  • 33
  • 42

2 Answers2

34

In Spring 3.x you should use JdbcTemplate.

In previous versions of Spring SimpleJdbcTemplate leveraged new features of Java 5, whereas JdbcTemplate maintained compatibility with pre-Java 5 environments. But now all features of SimpleJdbcTemplate have been added to JdbcTemplate.

axtavt
  • 239,438
  • 41
  • 511
  • 482
  • 10
    It's not the only difference - `SimpleJdbcTemplate` supports named parameters like in `NamedParameterJdbcTemplate`, but `JdbcTemplate` only supports `?` style parameters. – jmruc Apr 25 '12 at 12:04
  • Thanks a lot.The query we are using is whether DB specific in SpringJDBC or SpringJDBC provides any option that our query will run in any kind of DB like Hibernate provides HQL.(Now i am using SQL DB in future i might go with oracle , So the same will run in oracle or needs any change in future) – Mohan Apr 25 '12 at 13:27
  • No, spring HSBC doesn't provide any abstraction over SQL. – axtavt Apr 25 '12 at 13:50
0

In spring 4.1.3, SimpleJdbcTemplate is deprecated and it has been completely removed in 4.3.3

Sameera Manorathna
  • 558
  • 12
  • 26
  • Deprecated in Spring 3.1 - https://docs.spring.io/spring-framework/docs/3.1.x/javadoc-api/org/springframework/jdbc/core/simple/SimpleJdbcTemplate.html source: https://stackoverflow.com/questions/3365359/java-spring-jdbctemplate – Curtis Yallop Jun 25 '21 at 04:32