如何快速将数据从ResultSet映射到某个bean? [英] How to quickly map data from ResultSet to some bean?
本文介绍了如何快速将数据从ResultSet映射到某个bean?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jdbcTemplate,并且有一个由大约100个命名字段组成的ResultSet。我有一些对象(bean),包括所有这些字段和适当的getter / setter。
有没有办法快速将结果集映射到我的对象,所以我不需要手动调用所有这些setter?当然,假设,ResultSet返回的字段包含每个字段的正确别名?
I'm using jdbcTemplate, and have a ResultSet consisting of about 100 named fields. And I have some object (bean), consisting of all those fields and appropriate getters/setters. Is there any way to just quickly map the result set to my object, so I don't need to manually call all those setters? Of course, assuming, that ResultSet returns fields with proper alias for every field?
推荐答案
回答自己 - BeanPropertyRowMapper是我需要的,非常感谢google
Answering to myself - BeanPropertyRowMapper is what I need, many thanks to google
这篇关于如何快速将数据从ResultSet映射到某个bean?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文