Skip to content

[OPENJPA-2971] Make PostgreSQL StoreCharsAsNumbers default overridable and release-note it - #163

Open
rzo1 wants to merge 1 commit into
masterfrom
OPENJPA-2971
Open

[OPENJPA-2971] Make PostgreSQL StoreCharsAsNumbers default overridable and release-note it#163
rzo1 wants to merge 1 commit into
masterfrom
OPENJPA-2971

Conversation

@rzo1

@rzo1 rzo1 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Since #144 PostgresDictionary.connectedConfiguration() unconditionally set storeCharsAsNumbers=false on PostgreSQL 9+. Because DBDictionaryFactory applies the user's DBDictionary plugin properties before connectedConfiguration(), an explicit StoreCharsAsNumbers=true was silently clobbered, breaking schemas created by earlier OpenJPA releases (char fields in INTEGER columns).

This adds setStoreCharsAsNumbers()/getStoreCharsAsNumbers() to DBDictionary (Options prefers the setter over the public field) to track an explicit user value, makes native CHAR storage the PostgresDictionary constructor default, and only falls back to numeric storage on PostgreSQL < 9 when nothing was configured explicitly. The public field is kept for backward compatibility.

Documents the new default and the opt-out (openjpa.jdbc.DBDictionary=postgres(StoreCharsAsNumbers=true)) in the reference guide and the JPA 3.2 migration considerations, and adds TestPostgresDictionary covering defaults, explicit overrides via plugin properties / setter / field, and DBDictionaryFactory end-to-end. The TCK-relevant default (CHAR columns) is unchanged.

Ref: #144 (comment)

Since #144 PostgresDictionary.connectedConfiguration() unconditionally set
storeCharsAsNumbers=false on PostgreSQL 9+, clobbering an explicit
StoreCharsAsNumbers=true from the DBDictionary plugin properties (which are
applied before connectedConfiguration()). Track explicit user values via a
new setStoreCharsAsNumbers() setter, make native CHAR storage the
PostgresDictionary default and only fall back to numeric storage on
PostgreSQL < 9 when not configured explicitly. Document the new default and
the opt-out in the reference guide and migration considerations; add
TestPostgresDictionary.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJiFSo4QfgPaz7i5UQPREw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant