JdbcTemplate and SimpleJdbcTemplate
Asked Answered
E

2

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.

Evieevil answered 25/4, 2012 at 11:24 Comment(0)
F
35

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.

Frock answered 25/4, 2012 at 11:43 Comment(3)
It's not the only difference - SimpleJdbcTemplate supports named parameters like in NamedParameterJdbcTemplate, but JdbcTemplate only supports ? style parameters.Rihana
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)Evieevil
No, spring HSBC doesn't provide any abstraction over SQL.Frock
P
0

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

Puzzle answered 27/1, 2019 at 12:44 Comment(1)

© 2022 - 2024 — McMap. All rights reserved.