Hello everyone,
 
Can anyone clarify my understanding:
 
I have an entity ("Organization") that I often fetch by it's key (a
String).
 
In DB2 (v9.5 community) the ID field is a CHAR(10).
 
I've been using EntityManger.find(Class, String) to do the job for
months.
 
I was prettying-up URLs in my web layer when I noticed this behavior:
 
(1) When I pass in: "ORG-10    " (note the trailing spaces) I get an
entity with "ORG-10    " (with trailing spaces) as it's ID.
 
(2) When I pass in "ORG-10" (trimmed) I get an entity with "ORG-10"
(trimmed) as it's ID.
 
Behavior #2 surprised me! I expected "ORG-10    ", with trailing spaces,
just as it is in the database.
 
As an experiment, I changed my service implementation to use a query on
the key instead of find() and the behavior goes away.  That is, I get
"ORG-10    " as the ID of the Organization regardless of whether the
input was trimmed or not.
 
Am I misunderstanding how it should work?
 
  --Rich
 

Reply via email to