开发者

Spring SimpleJdbcTestUtils example

开发者 https://www.devze.com 2023-01-26 10:38 出处:网络
Now developing stand alone application with Spring JDBC support. Trying to do some integration testing and found SimpleJdbcTestUtils utility class, but sadly can\'t find any example how to use it.

Now developing stand alone application with Spring JDBC support. Trying to do some integration testing and found SimpleJdbcTestUtils utility class, but sadly can't find any example how to use it.

Could someone provide开发者_运维知识库 me with a example how to use SimpleJdbcTestUtils ?


It's just a utility class... what are you wanting to do?

It works using a JdbcTemplate which is another handy little Spring util. A common use for it is to execute quick little JDBC queries to count rows in tables.

it's just shorthand - read the javadocs/source and you should get an idea of what the intention is (honestly, spring's source is easy to read..)

anyway jdbctemplate is useful to understand, but maybe more interesting from a testing perspective is the transactional test superclasses, which do transaction management. All covered in the spring html docs on their site.

Anyway found an example for you, as requested:

https://svn.codehaus.org/mod4j/tags/mod4j-1.1.0/Examples/RecordShop-ExampleProject/RecordShop-data/src/test/java/org/company/recordshop/PersonDaoTest.java

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号