OpenJPA
  1. OpenJPA
  2. OPENJPA-1986

Extra queries being generated when cascading a persist

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1.0, 2.2.0
    • Fix Version/s: 2.1.1, 2.2.0
    • Component/s: performance
    • Labels:
      None

      Description

      I found a scenario where extra queries were being generated while cascading a persist to a new Entity. See the following example:

      @Entity
      public class CascadePersistEntity implements Serializable

      { private static final long serialVersionUID = -8290604110046006897L; @Id long id; @OneToOne(cascade = CascadeType.ALL) CascadePersistEntity other; ... }

      and the following scenario:
      CascadePersistEntity cpe1 = new CascadePersistEntity(1);
      CascadePersistEntity cpe2 = new CascadePersistEntity(2);
      cpe1.setOther(cpe2);
      em.persist(cpe1);

      This results in two inserts and one select. The extra select is what I'm going to get rid of with this JIRA.

        Activity

        Rick Curtis created issue -
        Rick Curtis made changes -
        Field Original Value New Value
        Attachment OPENJPA-1986.patch [ 12477565 ]
        Rick Curtis made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Rick Curtis made changes -
        Fix Version/s 2.1.1 [ 12316191 ]
        Rick Curtis made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Rick Curtis
            Reporter:
            Rick Curtis
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development