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

        Hide
        Rick Curtis added a comment -

        Since this could change the behavior of some existing applications I'm going to put in a compatibility property that will allow us to revert the change.

        Show
        Rick Curtis added a comment - Since this could change the behavior of some existing applications I'm going to put in a compatibility property that will allow us to revert the change.
        Hide
        Rick Curtis added a comment -

        Attaching a code change and test case.

        Show
        Rick Curtis added a comment - Attaching a code change and test case.
        Hide
        Rick Curtis added a comment -

        Committed revision 1097209 to trunk.

        Show
        Rick Curtis added a comment - Committed revision 1097209 to trunk.
        Hide
        Rick Curtis added a comment -

        Committed changes to trunk.

        Show
        Rick Curtis added a comment - Committed changes to trunk.
        Hide
        Rick Curtis added a comment -

        When porting this code back to 2.1.x, we need to make sure to flip the compatibility option so we don't break any existing applications.

        Show
        Rick Curtis added a comment - When porting this code back to 2.1.x, we need to make sure to flip the compatibility option so we don't break any existing applications.
        Hide
        Rick Curtis added a comment -

        Closing resolved issues.

        Show
        Rick Curtis added a comment - Closing resolved issues.
        Hide
        ASF subversion and git services added a comment -

        Commit 1580898 from Heath Thomann in branch 'openjpa/branches/2.2.x'
        [ https://svn.apache.org/r1580898 ]

        OPENJPA-1986: Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.

        Show
        ASF subversion and git services added a comment - Commit 1580898 from Heath Thomann in branch 'openjpa/branches/2.2.x' [ https://svn.apache.org/r1580898 ] OPENJPA-1986 : Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.
        Hide
        ASF subversion and git services added a comment -

        Commit 1580903 from Heath Thomann in branch 'openjpa/branches/2.1.x'
        [ https://svn.apache.org/r1580903 ]

        OPENJPA-1986: Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.

        Show
        ASF subversion and git services added a comment - Commit 1580903 from Heath Thomann in branch 'openjpa/branches/2.1.x' [ https://svn.apache.org/r1580903 ] OPENJPA-1986 : Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.
        Hide
        ASF subversion and git services added a comment -

        Commit 1580907 from Heath Thomann in branch 'openjpa/branches/2.2.1.x'
        [ https://svn.apache.org/r1580907 ]

        OPENJPA-1986: Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.

        Show
        ASF subversion and git services added a comment - Commit 1580907 from Heath Thomann in branch 'openjpa/branches/2.2.1.x' [ https://svn.apache.org/r1580907 ] OPENJPA-1986 : Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.
        Hide
        ASF subversion and git services added a comment -

        Commit 1580909 from Heath Thomann in branch 'openjpa/branches/2.3.x'
        [ https://svn.apache.org/r1580909 ]

        OPENJPA-1986: Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.

        Show
        ASF subversion and git services added a comment - Commit 1580909 from Heath Thomann in branch 'openjpa/branches/2.3.x' [ https://svn.apache.org/r1580909 ] OPENJPA-1986 : Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.
        Hide
        ASF subversion and git services added a comment -

        Commit 1580913 from Heath Thomann in branch 'openjpa/trunk'
        [ https://svn.apache.org/r1580913 ]

        OPENJPA-1986: Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.

        Show
        ASF subversion and git services added a comment - Commit 1580913 from Heath Thomann in branch 'openjpa/trunk' [ https://svn.apache.org/r1580913 ] OPENJPA-1986 : Extra queries being generated when cascading a persist - added another/similar check to the ones added by Rick.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development