Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-688

Problem with lazy loading

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0 Beta 5
    • 3.0 Beta 6
    • Core
    • None

    Description

      When calling an association property from the object itself, null is associated with the object and this leads to NPE or unwanted results.
      For example, if I have a class :
      public class Person {
      private Long id;
      private String firstName;
      private String lastName;
      private Person parent;
      public Person getAncestor() {
      if (getParent() == null)

      { return this; }

      else

      { return getParent().getAncestor(); }

      }
      //Other getters and setters.
      }

      And a method calls person.getAncestor(), this.getParent() inside getAncestor() method will return null.
      But if the method calls person.getParent() and then person.getAncestor(), this.getParent() inside getAncestor() method will return the expected parent.

      Attachments

        1. cglib_lazy_error_patch.zip
          2 kB
          Christian Poitras
        2. cglib_lazy_error.zip
          6 kB
          Christian Poitras
        3. ibatis-lazy-load.patch.zip
          4 kB
          Olivier Monaco
        4. ibatis-lazy-load-unittests.zip
          3 kB
          Olivier Monaco

        Activity

          People

            cbegin Clinton Begin
            mindtrap Christian Poitras
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: