OpenJPA
  1. OpenJPA
  2. OPENJPA-834

State field mapped to XML column has incorrect value when loaded from database

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.0, 2.0.0-M2
    • Fix Version/s: 1.3.0, 2.0.0-M2
    • Component/s: kernel
    • Labels:
      None
    • Environment:
      Database with XML column support

      Description

      The org.apache.openjpa.persistence.xmlmapping.xmlbindings.myaddress.Address is a class with JAXB annotations. It has a property street of type List<String>. When an entity containing Address in its state field is loaded from database, the street property is empty.

      My initial investigation led me to a conclusion that the issue is caused by a proxy returned from ProxyManagerImpl.newCustomProxy(Object) which does not behave correctly.

      1. OPENJPA-834.patch
        1 kB
        Milosz Tylenda

        Issue Links

          Activity

          Hide
          Milosz Tylenda added a comment -

          OPENJPA-833 contains a test case for this.

          Show
          Milosz Tylenda added a comment - OPENJPA-833 contains a test case for this.
          Hide
          Milosz Tylenda added a comment -

          Heh, the issue is simpler - the Address class needs a setter for the street property. Otherwise ProxyBean.newInstance(Object) will not copy that property.

          I will send a patch soon.

          Show
          Milosz Tylenda added a comment - Heh, the issue is simpler - the Address class needs a setter for the street property. Otherwise ProxyBean.newInstance(Object) will not copy that property. I will send a patch soon.
          Hide
          Milosz Tylenda added a comment -

          The patch adds a setter for the street property. If applying the patch, please remove the @AllowFailure from the test case.

          Show
          Milosz Tylenda added a comment - The patch adds a setter for the street property. If applying the patch, please remove the @AllowFailure from the test case.
          Hide
          Milosz Tylenda added a comment -

          The XJC generator can be forced to generate setters for collections by using a plug-in [1]. The manual could be updated with that information.

          [1] https://jaxb2-commons.dev.java.net/collection-setter-injector/

          Show
          Milosz Tylenda added a comment - The XJC generator can be forced to generate setters for collections by using a plug-in [1] . The manual could be updated with that information. [1] https://jaxb2-commons.dev.java.net/collection-setter-injector/
          Hide
          Catalina Wei added a comment -

          Milosz,
          Thanks for the patch.
          Do you mind documenting the XJC plug-ins that generate the setters for collections in our Manual - the xmlmapping section ?

          The issue remains open until proper documentation is in place.

          Thank you for the work.

          Show
          Catalina Wei added a comment - Milosz, Thanks for the patch. Do you mind documenting the XJC plug-ins that generate the setters for collections in our Manual - the xmlmapping section ? The issue remains open until proper documentation is in place. Thank you for the work.
          Hide
          Milosz Tylenda added a comment -

          Catalina,
          I will provide a patch for the manual.

          Show
          Milosz Tylenda added a comment - Catalina, I will provide a patch for the manual.
          Hide
          Milosz Tylenda added a comment -

          I have incorporated the changes for the manual into the patch for OPENJPA-861.

          Show
          Milosz Tylenda added a comment - I have incorporated the changes for the manual into the patch for OPENJPA-861 .
          Hide
          Catalina Wei added a comment -

          Updates to the manual has been provided by Milosz Tylenda and committed under following revisions:
          trunk: - r737799
          1.3.x - r737801

          Show
          Catalina Wei added a comment - Updates to the manual has been provided by Milosz Tylenda and committed under following revisions: trunk: - r737799 1.3.x - r737801

            People

            • Assignee:
              Unassigned
              Reporter:
              Milosz Tylenda
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development