Skip to main content
Jump to: navigation, search

Difference between revisions of "EclipseLink/DesignDocs/328404"

(Project overview)
(Config files)
Line 71: Line 71:
  
 
== Config files ==
 
== Config files ==
 +
 +
* Proposed configuration of SessionBroker persistence unit is done entirely through Persistence Unit properties.
 +
 +
* The two main use cases:
 +
 +
** Unify multiple persistence units (with independent from each other object models).
 +
There are two predefine independent persistence units:  puABC (that maps classes A, B, C) and puXYZ (that maps classes X, Y, Z).
 +
None of A, B, C classes references any of X, Y, Z classes and vise verse.
 +
 +
*** User starts with several independent persistence units, creates a new SessionBroker persistent unit that aggregates ServerSessions defined in the original persistence units.
 +
*** The original persistence units remain unchanged, could still be used individually.
 +
 +
** Split single persistent unit.
 +
*** User starts with a single persistence unit, alters it to become SessionBroker persistence unit.
  
 
== Documentation ==
 
== Documentation ==

Revision as of 13:44, 22 October 2010

Design Specification: Support SessionBroker in JPA

ER 328404

Document History

2010/10/22 Andrei Ilitchev Initial Version

Project overview

The goal is to allow for different classes contained in a single persistence context to be mapped to different databases.

em.persist(new A(..));
em.persist(new Z(..));
// insert A into db1; insert Z into db2:
// the two different data bases possibly from different vendors
em.flush();

Concepts

  • Currently each persistence unit has a single ServerSession.
    • ServerSession typically connected to a single data base.
      • Even though ServerSession may use connection pools that connected to different data bases these databases always should share the same database platform.
        • That means it's impossible to use ServerSession to map different classes to different types of data bases (say, Oracle and MySQL).
  • Eclipselink core defines SessionBroker class that aggregates several ServerSessions.
    • SessionBroker maps each class to a single ServerSession.
    • Each ServerSession connected to a different data base.
      • These ServerSessions are not required to share the same database platform.
      • Therefore different classes mapped to different data bases, too.
  • This feature is going to define persistence unit that has a SessionBroker instead of ServerSession.
    • Let's call Container persistence unit (or SessionBroker persistence unit).

Requirements

  • SessionBroker persistence unit must be defined in persistence.xml (as any other persistence unit).
  • The two main use cases:
    • Unify multiple persistence units (with independent from each other object models).
      • User starts with several independent persistence units, creates a new SessionBroker persistent unit that aggregates ServerSessions defined in the original persistence units.
      • The original persistence units remain unchanged, could still be used individually.
    • Split single persistent unit.
      • User starts with a single persistence unit, alters it to become SessionBroker persistence unit.

Design Constraints

Design / Functionality

  • ServerSessions that are aggregated by a SessionBroker persistence unit are "invisible" outside of it:
    • don't have EntityManagerFactories associated with them;
    • EntityManagerSetupImpl used for their creation are not kept;
    • these sessions are not stored in SessionManager.

Testing

API

GUI

Config files

  • Proposed configuration of SessionBroker persistence unit is done entirely through Persistence Unit properties.
  • The two main use cases:
    • Unify multiple persistence units (with independent from each other object models).

There are two predefine independent persistence units: puABC (that maps classes A, B, C) and puXYZ (that maps classes X, Y, Z). None of A, B, C classes references any of X, Y, Z classes and vise verse.

      • User starts with several independent persistence units, creates a new SessionBroker persistent unit that aggregates ServerSessions defined in the original persistence units.
      • The original persistence units remain unchanged, could still be used individually.
    • Split single persistent unit.
      • User starts with a single persistence unit, alters it to become SessionBroker persistence unit.

Documentation

Open Issues

This section lists the open issues that are still pending that must be decided prior to fully implementing this project's requirements.

Issue # Owner Description / Notes

Decisions

This section lists decisions made. These are intended to document the resolution of open issues or constraints added to the project that are important.

Issue # Description / Notes Decision

Future Considerations

During the research for this project the following items were identified as out of scope but are captured here as potential future enhancements. If agreed upon during the review process these should be logged in the bug system.

Back to the top