Spring Tutorial 39 - Using JdbcTemplate

preview_player
Показать описание
We'll use the JdbcTemplate class provided by Spring to implement a DAO method. We'll see how using the template class makes the DAO methods simple, and how it takes care of much of the boilerplate code we'd have to write otherwise.
Рекомендации по теме
Комментарии
Автор

Even after 8 years, your tutorials on this stuff are the best!

ron
Автор

queryForInt(String) is deprecated, currently solution: jdbcTemplate.queryForObject(sql, Integer.class);

TheUnixHead
Автор

Damn, this is probably the best feature of Spring so far.

Qladstone
Автор

Thank you so much sir, due to spring core, spring AOP and spring Data. now i can easily understand how spring beans talks to each other. previously i just used to write the spring code without thinking much of beans. thank you so much.

rtech
Автор

queryForInt() and queryForLong() are deprecated since version 3.2.2 .

public int getCircleCount()
{
String sql = "select count(*) from circle";

return jdbcTemplate.queryForObject(sql, Integer.class);

}

rahulkaitheri
Автор

Hi sir,
First of all thanks for such awesome tutorials.
I have an use case in which i need to know if table exists in the database if not then need to create one using jdbcTemplate.

Can you please help me out here?

nevilparekh
Автор

Thanks koushik .please add some spring-mvc tutorials .Thanx in advance.

patramanoj
Автор

If anyone is getting the "java.sql.SQLException: executeQuery method can not be used for update." exception for the getCircleCount() method.
Then, verify the "SQL" query whether it has some spelling mistakes. eg: "select" may be written like "slect"

ankur.logics
Автор

thank you very much!! it is realy interesting! could you please make videos on GWT

moulouze
Автор

how can i use jdbc template for pagination stuff ? Can someone help me ?

RealEyes
Автор

Sir how to inject datasource in DAO from XML? Please help me solve this

kumarasamy
Автор

which jar did u import. can u show me the list

simonfan
Автор

Koushik, Spring transaction manager and it's concepts like propagation, isolation levels etc not explained well and it is very confusing in most of the playlist available in youtube. Can you please publish some videos on it.

bhuvaneshkadaraiah
Автор

Hi, Someone can tell me where can I download this video with good quality? I have 1-35 lessons (Level 1 and 2) with nice quality video, but now I need level 3 (videos up from 35).

Thank you!

ElAyod
Автор

For the first trial of jdbcTemplate I always get
java.sql.SQLException: executeQuery method can not be used for update.

anyidea??

weeka
Автор

I think we don't need to instantiate jdbcTemplate in this case:
private JdbcTemplate jdbcTemplate = new JdbcTemplate();
as it will be instantiated further.

cachwahed
Автор

Why when I put @Autowire before "private DataSource dataSource;" and not before the "setDataSource" method, it doesn't work?
Isn't dataSource variable initialized by spring by the setter method? It's private, there's no other way...

SoeaOu
Автор

HI Koushik, am getting class not found exception even with simple JdbcTemplate initialisation..cant find any reason on web, I have all supporting jars .. not sure what triggering

naveennarsaglla
Автор

You need to add
<property name = "username" value = "username"/>
<property name = "password" value = "password"/>
in you dataSource bean, if your database has user and password

alexop
Автор

If u teach some other story book that's too good plz dont explain java like this...what do u say and what do u want to teach u really donnt know plz see ur video by urself.

CodeCraftersHr