A workaround?? Or do i need to know every field size?
I'am facing with the same problem.
In my case: I'm connecting to a DB2 database. Some primary keys are VARCHARs. But in indices, DB2 always stores the max. string size specified in VARCHAR(n). The bevaiour exactly like your problem. The data out of the index comes like for CHAR columns: With spaces.
As a workaround, I am wondering, if it is possible to trim all columns of type CHAR/VARCHAR in the result set, bevor the data is stored in the entity bean. Actually: No idea.
this is DB dependent,
for example on DB2/400 work fine.
May be a good idea to avoid CHAR and use VARCHAR instead.