openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From areider <open...@reider.net>
Subject Padding of CHAR(n) columns with trailing spaces
Date Sun, 15 May 2011 00:56:11 GMT
When a fixed-length CHAR column is mapped to a Java string, in JPA1.2.3 the
value does not contain trailing spaces. In JPA 2.0.2, the value is
blank-added to the length of column in the database (DB2 with JDBC Universal
driver). For example a column is defined as CHAR(5). The value M1C1 appears
as "M1C1 " and "M1C1" respectively. 

I'm assuming that padding (or not trimming) is the correct behavior although
I cannot find a definitive cite (either for what a JDBC driver should return
or what JPA should do to the value, if anything). 

Is JPA2.0.2 deliberately padding to the length of the field or is JPA1.2.3
deliberately trimming? Or is JPA leaving the field as it comes back from the
JDBC driver? I think I have established that the driver is the same in both
environments (Rad7 7.0.0.13 with openjpa-1.2.3-SNAPSHOT-r422266:965640 and
Websphere Application Server 7.0.0.13 with
openjpa-2.0.2-SNAPSHOT-r422266:1032678)

--
View this message in context: http://openjpa.208410.n2.nabble.com/Padding-of-CHAR-n-columns-with-trailing-spaces-tp6364510p6364510.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message