开发者

Spring StoredProcedure Resultset value trim

开发者 https://www.devze.com 2023-01-23 13:09 出处:网络
I currently have some code written using JAVA Spring 2.5.2 and JDBC to connect to the database and execute store procedures that return a ResultSet.Because all of the database columns are def开发者_开

I currently have some code written using JAVA Spring 2.5.2 and JDBC to connect to the database and execute store procedures that return a ResultSet. Because all of the database columns are def开发者_开发问答ined as char (fixed length), the values that I am retreiving from the resultset contain whitespaces at the end.

I am currently extending the org.springframework.jdbc.object.StoredProcedure class to access the databse and a simple org.springframework.jdbc.core.SqlReturnResultSet and org.springframework.jdbc.core.RowMapper combination to iterate over the resultset.

Is there a built-in function in Spring to go do this without having to call org.springframework.util.StringUtils.trimWhitespace(String) for each String parameter in the resultset?


I think there's no automated way to do that since you're pretty much getting the raw ResultSet and it's your responsibility to read the data and convert it however you want in order to match the properties in your DAO.

0

精彩评论

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