Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Development/JPA 2.0/properties processing"
(→getSupportedProperties limitation) |
(→Functional Requirements) |
||
Line 27: | Line 27: | ||
== Functional Requirements == | == Functional Requirements == | ||
+ | === Entity Manager Factories and SeverSessions === | ||
+ | === Current behaviour === | ||
+ | # Several EntityManagerFactories corresponding to the same persistence unit (and loaded from the same resource) share the same ServerSession. | ||
+ | ## The ServerSession is configured according to the properties of the first factory to create EntityManager. | ||
+ | ### That mean the properties specified by all other EntityManagerFactories are ignored. | ||
+ | # The only way to create an EntityManagerFactory that uses a different ServerSession is to specify SESSION_NAME in createEntityManagerFactory properties. | ||
=== Entity Manager Properties === | === Entity Manager Properties === | ||
==== Two groups of properties ==== | ==== Two groups of properties ==== | ||
Line 63: | Line 69: | ||
# JDBC_PASSWORD | # JDBC_PASSWORD | ||
# CONNECTION_POLICY | # CONNECTION_POLICY | ||
− | |||
− | |||
== Existing Feature Impact == | == Existing Feature Impact == |
Revision as of 10:49, 27 October 2009
JPA 2.0: Property Processing
Date | Committer(s) | Description |
---|---|---|
March 24, 2009 | gyorke | Initial feature template |
Summary
The JPA 2.0 Specification provides functionality to set properties on the EntityManager at runtime. Before that feature can be completed we must define what properties can be set on the Entity Manager and when. This will allow use to clearly communicate to our customers how and when certain configurations can be applied. We must also update our property processing to ensure properties can be processed on a per property basis and that the property processing functionality is complete and available.
Work Estimate
- Define all properties and when they apply
- 1 day
- Update property processing to account for lifecycle and validation
- 4 days
- write tests to verify validation and lifecycle
- 2 days
Functional Requirements
Entity Manager Factories and SeverSessions
Current behaviour
- Several EntityManagerFactories corresponding to the same persistence unit (and loaded from the same resource) share the same ServerSession.
- The ServerSession is configured according to the properties of the first factory to create EntityManager.
- That mean the properties specified by all other EntityManagerFactories are ignored.
- The ServerSession is configured according to the properties of the first factory to create EntityManager.
- The only way to create an EntityManagerFactory that uses a different ServerSession is to specify SESSION_NAME in createEntityManagerFactory properties.
Entity Manager Properties
Two groups of properties
Only properties passed to createEM method guaranteed to take effect right away.
Some EntityManager properties could be applied to the unit of work which already exists, other can't. For each property that should be clearly listed in EntityManagerProperty class comments.
- For each property of the first group, property value processed immediately as setProperty called.
- Each time getActivePersistenceContext is called the processed property value is set in the uow.
- Obvious optimization to add a flag indicating whether any of first group properties has changed since being last time set into the uow.
- Each time getActivePersistenceContext is called the processed property value is set in the uow.
- Properties of the second group processed and applied only when the new uow is created.
- User have to call em.clear() unless property applied to a brand new EntityManager.
- Even if the em is new, some application servers (was, oc4j) would have already created uow (they likely call em.joinTransaction()).
- User have to call em.clear() unless property applied to a brand new EntityManager.
First group: properies applicable to existing uow
- JOIN_EXISTING_TRANSACTION
- PERSISTENCE_CONTEXT_CLOSE_ON_COMMIT
- PERSISTENCE_CONTEXT_PERSIST_ON_COMMIT
- PERSISTENCE_CONTEXT_COMMIT_WITHOUT_PERSIST_RULES
- PERSISTENCE_CONTEXT_FLUSH_MODE
- VALIDATE_EXISTENCE
- FLUSH_CLEAR_CACHE
Second group: properies that require new uow
- PERSISTENCE_CONTEXT_REFERENCE_MODE
- ORACLE_PROXY_TYPE
- EXCLUSIVE_CONNECTION_MODE
- EXCLUSIVE_CONNECTION_IS_LAZY
- JTA_DATASOURCE
- NON_JTA_DATASOURCE
- JDBC_DRIVER
- JDBC_URL
- JDBC_USER
- JDBC_PASSWORD
- CONNECTION_POLICY
Existing Feature Impact
Feature | Supported | Notes |
---|