Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Correct place to override type conversion?

Hello; where in a DatabasePlatform subclass is it possible to correct system-wide type conversion issues?

I noticed for example that the InformixPlatform *seems* to define a Boolean.class type mapping to "SMALLINT default 0" in its protected Hashtable buildFieldTypes() method.

But Informix supports a very weird boolean literal (http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=%2Fcom.ibm.sqls.doc%2Fids_sqs_1400.htm).  It is either t or f. Those are not strings, those are literal symbols.  (Nevertheless in Hibernate we had to override *their* Informix support to pass them with single quotes around them.  We might have to do the same thing here.)

I'm not clear on the contract of this method--is it to be used for all (primitive, scalar) mappings everywhere (unless otherwise massaged via converters, etc.), or is it used only in, say, DDL generation (which we don't use)?

Our codebase also assumes that database values defined as Informix BIGINT (2^63-1 max value) are represented as Java longs, not BigDecimal (a Java long has the same upper capacity).  (We can work around this by changing our code to expect Numbers back and then call longValue().)

I'd like to correct these mistakes in our subclass of InformixPlatform itself (not in lots of converters).

Where would be the best place to correct these mappings?  Is it indeed in the Hashtable returned by buildFieldTypes()?

Best,
Laird

--
http://about.me/lairdnelson

Back to the top