Other adapters address trailing space problem by some combination of
a trimming CharType and TrimmingQualifierTranslator (see
SybaseAdapter and SQLServerAdapter):
map.registerType(new CharType(true, false));
public QualifierTranslator getQualifierTranslator(QueryAssembler
queryAssembler) {
return new TrimmingQualifierTranslator(
queryAssembler,
SQLServerAdapter.TRIM_FUNCTION);
}
This would be a more generic solution based on things already in
Cayenne. I think it may fix your case as well.
Andrus
On May 20, 2006, at 1:17 PM, Øyvind Harboe wrote:
I'm having a problem with a legacy database that have string primary
keys where there occasionally are extra spaces after the primary key.
SQL will ignore trailing spaces in WHERE clauses, i.e. WHERE
"FOO"="FOO<SPACE>" will yield a match, so this works in the
legacy application I'm porting.
However, Cayenne throws a bogus hollow objection exception.
I managed to find a workaround where I trimmed spaces from primary
keys
passed into the ObjectId constructor.
See my working notes & patch at the end:
http://issues.apache.org/cayenne/browse/CAY-550
--
Øyvind Harboe
http://www.zylin.com