JDO
  1. JDO
  2. JDO-589

Allow makePersistent outside a transaction

    Details

      Description

      JPA allows users to call makePersistent outside a transaction, and then when beginning and committing a transaction, the instances are made persistent.

      This is similar to nontransactional dirty in which the managed instances can be modified outside a transaction and then the changes committed within a transaction.

      From the JPA spec, "When an EntityManager with an extended persistence context is used, the persist, remove, merge, and refresh operations may be called regardless of whether a transaction is active. The effects of these operations will be committed to the database when the extended persistence context is enlisted in a transaction and the transaction commits."

      This behavior should not be the default behavior (for backward compatibility reasons if not the principle of least surprise) so it should be under control of a PersistenceManager and PersistenceManagerFactory flag, perhaps NontransactionalNew.

        Activity

        Craig L Russell created issue -
        Hide
        Matthew T. Adams added a comment -

        Time to play name that constant! How about NontransactionalPersist or NontransactionalMakePersistent?

        Show
        Matthew T. Adams added a comment - Time to play name that constant! How about NontransactionalPersist or NontransactionalMakePersistent?
        Craig L Russell made changes -
        Field Original Value New Value
        Component/s specification [ 12311332 ]
        Component/s tck2 [ 11652 ]
        Hide
        Andy Jefferson added a comment -

        Presumably this means simply that the user can select if they have atomic nontransactional writes (whether persist, delete or update) or whether they want them leaving til the next transaction. What if they select the latter and the PM is closed? do they just get lost like in some popular ORM?

        DataNucleus provides atomic persists/deletes (not updates yet) by default, and allowing them to go to the next transaction when enabled. When a PM is closed and there are outstanding updates then these are committed before completing the close.

        Show
        Andy Jefferson added a comment - Presumably this means simply that the user can select if they have atomic nontransactional writes (whether persist, delete or update) or whether they want them leaving til the next transaction. What if they select the latter and the PM is closed? do they just get lost like in some popular ORM? DataNucleus provides atomic persists/deletes (not updates yet) by default, and allowing them to go to the next transaction when enabled. When a PM is closed and there are outstanding updates then these are committed before completing the close.
        Michael Bouschen made changes -
        Fix Version/s JDO 3 maintenance release 2 (3.2) [ 12316653 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Craig L Russell
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development