0

I have the following setup.

'Apps/Reports' <---------> 'DB2 Connect' <------------> 'Legacy DB2 on AS400'
               `Hibernate`               `native calls`

When data is retrieved from by the application, it will be padded with extra spaces if the length is less that the column length. Of note when running a query, if the WHERE cause parameter is not padded, its automatically padded with extra spaces such that the query will retrieve the same records for a padded and non-padded parameter.

Is there a way (preferably on IBM DB2 Connect or connection string parameter) to remove extra whitespaces from a resultset?

4

2 回答 2

0

You could implement an hibernate UserType that automatically trim the strings. There are good exmaples on

https://forum.hibernate.org/viewtopic.php?t=928294

http://java.dzone.com/articles/annotating-custom-types

http://santescas.blogspot.de/2014/02/creando-un-usertype-de-hibernate-que-se.html

于 2014-02-20T11:51:28.113 回答
-1

Are the columns in the iSeries defined as CHAR()? I'm assuming so, because this is how CHAR() works -- it's a fixed field length, not a variable field length (that's what VARCHAR is for).

于 2010-10-08T02:37:58.580 回答