Repository navigation
[OPENJPA-3028] Store chars as CHAR by default on Oracle - #277
Merged
Merged
Conversation
OracleDictionary still stored char and Character attributes as NUMBER code points, so writing them into a pre-existing CHAR(1) column, such as the ones of the Jakarta Persistence TCK schema, failed with ORA-12899 (the code point '97' is two characters). Oracle has a CHAR type, so use the same default as Derby, H2, MySQL, MariaDB, SQL Server and PostgreSQL; an explicit StoreCharsAsNumbers=true is still respected. Oracle sizes columns in bytes by default (NLS_LENGTH_SEMANTICS=BYTE), so a generated CHAR(1) column of an AL32UTF8 database would reject any non-ASCII character, e.g. 'é' or '€', with ORA-12899. The generated column of a char or Character attribute is therefore declared with character length semantics, CHAR(1 CHAR), and holds every character the NUMBER mapping could hold. Behaviour change: schemas created by earlier releases on Oracle hold such attributes in NUMBER columns and need StoreCharsAsNumbers=true (or a migration to CHAR(1 CHAR)); newly generated columns are CHAR(1 CHAR). A pre-existing byte sized CHAR(1) column only holds single-byte characters. The migration notes and the StoreCharsAsNumbers reference say so. TestStoreCharsAsNumbersDefaults covers the Oracle default and the generated type name. TestCharStorage checks the default, round-trips non-ASCII characters and, on Oracle only, accepts the NUMBER type Oracle reports for integer columns.
solomax
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Oracle stored
char/Characteras NUMBER, which fails against CHAR(1) columns such as those in the TCK schema (ORA-12899). Oracle now defaults toStoreCharsAsNumbers=falselike the other dictionaries. Generated columns areCHAR(1 CHAR), so non-ASCII chars fit. Existing NUMBER schemas needStoreCharsAsNumbers=true(see migration notes).Oracle TCK: +100 passing tests, no regressions.