Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] JPQL produces SQL syntax error on Informix, but only because of PreparedStatement binding?

On Mon, Feb 25, 2013 at 7:57 AM, Tom Ware <tom.ware@xxxxxxxxxx> wrote:
  Does calling databasePlatform.setShouldBindLiterals(false) in a SessionCustomizer solve the issue?

Yes, but introduces another.  This too is due to Informix's bizarre syntax.

Specifically, it works fine for numbers (yay) and gets us past the Informix CASE syntax issue above.

But when binding boolean parameters by turning them into literals, EclipseLink seems to try to use numbers.

So a phrase like this in a WHERE clause:

WHERE is_active = ? // column defined as boolean in the database; JDBC type is Types.BOOLEAN

...with, say, a value supplied of Boolean.FALSE.booleanValue() (coming from Java-land), becomes (with the shouldBindLiterals property set to false):

WHERE is_active = 0 // oops; can't be 0 should be f--not a char, not a string, but the literal f

...which causes Informix to blow up, because it is expecting either a literal t (not a char, not a string, a literal lowercase t) or a literal f (not a char, not a string, a literal lowercase f).  (More on Informix and booleans: http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=%2Fcom.ibm.sqls.doc%2Fids_sqs_1400.htm)

This tells me that some global conversion logic in the InformixPlatform is not working properly.  Now that I've finally got my platform override class in place, where in that class can I globally override conversion behavior so that when EclipseLink decides to produce a boolean literal suitable for the database it will produce t or f in Informix's case?  This is true platform behavior, so I don't want to reference a converter in 38 gazillion places in the codebase. :-)

Thanks,
Best,
Laird

--
http://about.me/lairdnelson

Back to the top