Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.0
    • Component/s: jpa, kernel
    • Labels:
      None

      Description

      EntityManagers are not serializable or externalizable. This makes passivation of an EntityManager a difficult task. We should investigate how to externalize an EntityManager in a meaningful way. This could mean just writing out a stub that contains configuration information (potentially even just the persistence unit name, or the Configuration's ID), or it could mean actually serializing some or all of the local transactional cache to disk. The implications for the functionality available after deserialization would differ depending on the approach taken.

      I would like to see an implementation that efficiently wrote all the unflushed, dirty objects to disk. This would probably be best implemented via a writeReplace() strategy, to avoid handling all the transient fields in a Broker. Deserialization would then turn into a factory lookup plus some sort of in-place reattachment of the deserialized unflushed instances.

      Of course, if the entity instances themselves were not serializable, it would be difficult to write them to disk. Theoretically, we could just write out the corresponding StateManagers, and track the changed fields ourselves. I do not think that this is a good approach, however, since it would cause the deserialized objects to lose any non-persistent state after deserialization. I think that it is fair to require that instances be declared Serializable in order to use this feature.

      (We could optimize this a tad by detecting if an instance has only persistent fields, and if so, do our own serialization work.)

      1. openjpa-126.patch
        130 kB
        Patrick Linskey

        Activity

        Patrick Linskey created issue -
        Patrick Linskey made changes -
        Field Original Value New Value
        Fix Version/s 1.1.0 [ 12312344 ]
        Hide
        Patrick Linskey added a comment -

        This patch implements this feature as far as I am aware, including serialization of in-memory savepoints. It works for both enhanced and unenhanced persistent types.

        Primary limitations:

        • the entity classes in the entity manager must be Serializable
        • cannot serialize a pessimistic transaction
        • cannot serialize a broker that has been flushed
        • cannot serialize a broker that has affinity to a particular connection

        I have not done any testing in a managed environment whatsoever.

        I plan to commit these changes after making a jar available to some people for initial acceptance testing in the wild.

        Show
        Patrick Linskey added a comment - This patch implements this feature as far as I am aware, including serialization of in-memory savepoints. It works for both enhanced and unenhanced persistent types. Primary limitations: the entity classes in the entity manager must be Serializable cannot serialize a pessimistic transaction cannot serialize a broker that has been flushed cannot serialize a broker that has affinity to a particular connection I have not done any testing in a managed environment whatsoever. I plan to commit these changes after making a jar available to some people for initial acceptance testing in the wild.
        Patrick Linskey made changes -
        Attachment openjpa-126.patch [ 12369904 ]
        Hide
        Patrick Linskey added a comment -

        Reluctantly deferring to 1.2.0 due to size of change and lateness in the release process.

        Show
        Patrick Linskey added a comment - Reluctantly deferring to 1.2.0 due to size of change and lateness in the release process.
        Patrick Linskey made changes -
        Fix Version/s 1.2.0 [ 12313102 ]
        Priority Blocker [ 1 ]
        Fix Version/s 1.1.0 [ 12312344 ]
        Hide
        Patrick Linskey added a comment -

        This was actually submitted during the 1.1.0 timeframe, although it is currently undocumented.

        Show
        Patrick Linskey added a comment - This was actually submitted during the 1.1.0 timeframe, although it is currently undocumented.
        Patrick Linskey made changes -
        Fix Version/s 1.1.0 [ 12312344 ]
        Affects Version/s 1.1.0 [ 12312344 ]
        Fix Version/s 1.2.0 [ 12313102 ]
        Patrick Linskey made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        474d 7h 41m 1 Patrick Linskey 27/May/08 01:05
        Resolved Resolved Closed Closed
        651d 17h 26m 1 Donald Woods 09/Mar/10 18:32

          People

          • Assignee:
            Unassigned
            Reporter:
            Patrick Linskey
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development