Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-11664

DocumentBase JPA versus OJB change regarding saving/restoring documentHeader

    Details

    • Type: Bug Fix
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.4
    • Fix Version/s: 2.6
    • Component/s: Development, JPA
    • Security Level: Public (Public: Anyone can view)
    • Labels:
    • Rice Module:
      KRAD
    • KRAD Feature Area:
      Document
    • Application Requirement:
      KC
    • Sprint:
      2.4.0-rc1 Sprint 1, 2.4.0-rc1 Sprint 2, 2.4.0-rc1 Sprint 3, 2.4.0-rc1 Sprint 4, 2.4.0-rc1 Sprint 5, 2.4.0-rc1 Sprint 6, 2.4.0-rc1 Sprint 7, 2.4.0-rc1 Sprint 8
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required
    • Include in Release Notes?:
      Yes

      Description

      In KC we have a mixed JPA and OJB environment. Since the documentHeader is marked @Transient in the DocumentBase class there is logic to manually save and restore this reference. This logic is not working correctly for both JPA & OJB. In some cases, the documentheader becomes nulled out (from JPA) leading to exception regarding the workflow document not be found.

      In order to fix this in KC, I had to do the following in our KcTransactionalDocumentBase (formerly ResearchDocumentBase) class:

         @Override
          public void prepareForSave() {
              super.prepareForSave();
       
       //... removed KC specific logic ...
      
              documentHeader = KRADServiceLocatorWeb.getDocumentHeaderService().saveDocumentHeader(documentHeader);
          }
      
          @Override
          protected void prePersist() {
              //do not call super to remove the call to  DocumentHeaderService.saveDocumentHeader(documentHeader)
              if (StringUtils.isEmpty(getObjectId())) {
                  setObjectId(UUID.randomUUID().toString());
              }
          }
      
          @Override
          protected void postPersist() {
              super.postPersist();
              DocumentHeader temp = KRADServiceLocatorWeb.getDocumentHeaderService().getDocumentHeaderById(documentNumber);
              if (temp != null && temp.getWorkflowDocument() != null) {
                  documentHeader = temp;
              }
          }
      
          @Override
          public void postProcessSave(KualiDocumentEvent event) {
              super.postProcessSave(event);
              DocumentHeader temp =  KRADServiceLocatorWeb.getDocumentHeaderService().getDocumentHeaderById(documentNumber);
              if (temp != null && temp.getWorkflowDocument() != null) {
                  documentHeader = temp;
              }
          }
      

      I have no idea whether this is the best or the most efficient way to handle the documentHeader. I also don't know if it works in all cases but it appears to work for KC.

        Attachments

          Activity

          Hide
          gathreya Gayathri Athreya added a comment - - edited

          We have a workaround so marking it minor

          Show
          gathreya Gayathri Athreya added a comment - - edited We have a workaround so marking it minor
          Hide
          kbtaylor Kristina Taylor (Inactive) added a comment -

          We were unable to reproduce on our end, so we still need Travis to confirm whether there is still a bug or not with the latest branch version.

          Show
          kbtaylor Kristina Taylor (Inactive) added a comment - We were unable to reproduce on our end, so we still need Travis to confirm whether there is still a bug or not with the latest branch version.
          Hide
          tschneeb Travis Schneeberger added a comment -

          This is still a bug. If I remove my workaround from our base document the header is not restored correctly.

          Show
          tschneeb Travis Schneeberger added a comment - This is still a bug. If I remove my workaround from our base document the header is not restored correctly.
          Hide
          kbtaylor Kristina Taylor (Inactive) added a comment -

          The way I tested was locally with code that was just committed to 2.5 in https://fisheye.kuali.org/changelog/rice?cs=46800. Our test transactional document Travel Authorization will be available on env1 (when it refreshes) under the KRAD tab. I'm wondering if there's something special about your documents that is something we are not capturing.

          Show
          kbtaylor Kristina Taylor (Inactive) added a comment - The way I tested was locally with code that was just committed to 2.5 in https://fisheye.kuali.org/changelog/rice?cs=46800 . Our test transactional document Travel Authorization will be available on env1 (when it refreshes) under the KRAD tab. I'm wondering if there's something special about your documents that is something we are not capturing.
          Hide
          tschneeb Travis Schneeberger added a comment -

          Gayathri Athreya What should we do with this JIRA?

          Show
          tschneeb Travis Schneeberger added a comment - Gayathri Athreya What should we do with this JIRA?

            People

            • Assignee:
              gathreya Gayathri Athreya
              Reporter:
              tschneeb Travis Schneeberger
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 2 days
                2d
                Remaining:
                Remaining Estimate - 2 days
                2d
                Logged:
                Time Spent - Not Specified
                Not Specified