Spring Tutorial 41 - Implementing RowMapper

preview_player
Показать описание
In this tutorial, we implement a custom RowMapper class to map our domain objects. We then use this class to write fetch methods that return custom model objects.
Рекомендации по теме
Комментарии
Автор

These are splendid tutorials! Thank you very much for your effort!!!

ianagamurar
Автор

@moulouze1 Will be covering Hibernate soon in the Spring Data Support tutorial series.

Java.Brains
Автор

in the mapRow method in CircleMapper class, you didn't use the rowNum which would specify the row number from the resultSet.

tonyyan
Автор

Also we can pass BeanPropertyRowMapper as the third param with name of mapped class instead of implementing our own RowMapper. BeanPropertyRowMapper finds corresponding field names and sets values into them automatically.
P.S. however, Hibernate approach is the best :)

РоманИгнатенко-кэ
Автор

Ur simply awesome...U should make more video tutorial on JSF as well..

ThinkGreen
Автор

amazing, i am so happy i learnt jdbctemplate and rowmapper in one hour would have taken me a lot of cribbing and reading for a day otherwise.

santubudhe
Автор

Hi koushik,
Your videos are awesome I have seen your all videos of web services and spring.
How to handle exception when "select name from circle where id =?" return nothing in case of "jdbcTemplate.queryForObject(sql, new object[]{id}, String.class);" why it is raising error except 1 return 0.

girishvelivela
Автор

If there are joins of multiple tables and resultSet is not of any class type, then how to extract such datasets after execution. How to map them?

dipanjangoswami
Автор

i had a problem in doing this
getAllCircles() has a return type of List of circles but the return type of mapRow is circle so i got an error saying something like type mismatch cannot convert from circle to List<Circle> . Any solution

sivasai
Автор

hi!! koushik u r doing good job.when try to down load this video it shows some error .if dont mine upload this video once

svgames
Автор

hi could you please make videos on how to intergrate spring into hibernate

moulouze
Автор

You should change the name of column, because you don't have any column in your table which has a name like ID.

Abdelkarim
Автор

Hi.. Thanks for the tutorials, but when I am executing the same program for CircleMapper and trying to fetch the method getCirleById getting

Exception in thread "main" PreparedStatementCallback; uncategorized SQLException for SQL [SELECT NAME FROM CIRCLE where ID = ? ]; SQL state [XIE08]; error code [20000]; There is no column named: ID . ; nested exception is java.sql.SQLException: There is no column named: ID .

Could you pls help.

rakesh
Автор

so does that mean we have to create classes for each table in the db????

sachinrt
Автор

and if you want to print the List add following code in your main class..
List<Circle> l = dao.getAllCircle();
for(Circle each : l){
+ " " + each.getName());
}

vikramkanse
welcome to shbcf.ru