Skip to content

[OPENJPA-2982] Do not cache the factory properties before the EM defaults are known - #193

Closed
rzo1 wants to merge 1 commit into
masterfrom
OPENJPA-2982
Closed

rzo1 wants to merge 1 commit into
masterfrom
OPENJPA-2982

Conversation

@rzo1

@rzo1 rzo1 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

EntityManagerFactoryImpl.getProperties() cached its result even when no EntityManager existed yet, so the EM-level defaults were then missing from that map for good. The cache is now only installed once those defaults are known, and both fields are volatile so a caller racing with the first createEntityManager() cannot install an incomplete map either. TestEMFPropertiesCache covers both orderings.

…ults are known

getProperties() caches its result, so a call made before the first
EntityManager was created permanently lacked the EM level defaults.
Only install the cache once emEmptyPropsProperties is set, so a caller
racing with the first createEntityManager() can no longer make an
incomplete map stick, and make both fields volatile for visibility.
@rzo1 rzo1 self-assigned this Sep 25, 2026
@rzo1
rzo1 requested review from cristof and solomax September 25, 2026 19:48
@rzo1

rzo1 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing unmerged: CI showed that always merging the EntityManager level defaults breaks TestSchemaGenDrop, which feeds emf.getProperties() back into createEntityManagerFactory - those values are user readable (enums, live instances, unprefixed keys) and cannot be consumed as configuration. OPENJPA-2982 is closed as Not A Problem and the underlying contract question is tracked in OPENJPA-3006.

@rzo1 rzo1 closed this Sep 25, 2026
@rzo1
rzo1 deleted the OPENJPA-2982 branch September 25, 2026 20:17
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