How To Avoid Eclipselink Trimming Leading and Trailing Spaces? (Doc ID 1934388.1)

Last updated on AUGUST 16, 2016

Applies to:

Oracle TopLink - Version 12.1.2.0.0 and later
Information in this document applies to any platform.

Goal

How to handle a problem when an Entity has a mapped CHAR(2) field, and trailing spaces of it appear to be lost, resulting in non-successful updating/deleting of entities?

This is noticed because Eclipselink's SQL logs at FINE level show update/delete statements with:

  bind => [2014-10-02T18:47:09, 1]

despite it should be:

  bind => [2014-10-02T18:47:09, 1 ]

Closer inspection has shown that it has been the entity's find() method which has returned "1" despite it should have returned "1 " for the CHAR(2) column.
 

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms