Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-11417

Fix the mixing of OJB and JPA in KEW Rule Maintenance

    Details

    • Type: Bug Fix Bug Fix
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: Development, JPA
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Similar issues:
      KULRICE-11664DocumentBase JPA versus OJB change regarding saving/restoring documentHeader
      KULRICE-10286Convert KEW Rule tables to JPA
      KULRICE-1779Convert KEW Data Access Objects from OJB to JPA
      KULRICE-2377Create JPA instance of KEW class org.kuali.rice.kew.rule.dao.impl.RuleAttributeDAOOjbImpl
      KULRICE-2375Create JPA instance of KEW class org.kuali.rice.kew.notes.dao.impl.NoteDAOOjbImpl
      KULRICE-2376Create JPA instance of KEW class org.kuali.rice.kew.actiontaken.dao.impl.ActionTakenDAOOjbImpl
      KULRICE-2378Create JPA instance of KEW class org.kuali.rice.kew.edl.extract.dao.impl.ExtractDAOOjbImpl
      KULRICE-3876JPA - Convert KEW to use JPA
      KULRICE-11661PersistableBusinessObject.referenceReference has different behavior under JPA compared to OJB
      KULRICE-7060KIM Person Maintenance screen allows a new user to be created with mixed-case or uppercase letters in Principal Name field
    • Rice Module:
      KEW
    • Application Requirement:
      Rice
    • Sprint:
      2.4.0-m4 Dev Sprint 4 (Real), 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
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required
    • Include in Release Notes?:
      Yes

      Description

      At the moment, the rule screens are not working well I believe because of a mixing of OJB and JPA. Essentially, classes like WebRuleUtils are calling to backend services which have been converted to JPA and we're ending up with mixing and matching of OJB and JPA which causes all kinds of scary fun.

      We probably need to create things like LegacyRuleService, LegacyRuleTemplateService, etc. which essentially do the same thing the old OJB code did (using ojb dao instead of DataObjectService).

        Issue Links

          Activity

          Hide
          Jonathan Keller added a comment -

          Might be having code refresh issues - but I'm still bothered that there is anything which would cause these SQL when attempting to add a line:

          [EL Fine]: 2014-03-04 11:28:00.094--ClientSession(1383238319)--Connection(1575948658)--Thread(Thread[http-bio-8080-exec-3,5,main])--UPDATE KREW_RULE_T SET RULE_TMPL_ID = ?, VER_NBR = ? WHERE ((RULE_ID = ?) AND (VER_NBR = ?))
          	bind => [1030, 1, 1051, 0]
          [EL Fine]: 2014-03-04 11:28:00.096--ClientSession(1383238319)--Connection(1575948658)--Thread(Thread[http-bio-8080-exec-3,5,main])--INSERT INTO KREW_RULE_RSP_T (RULE_RSP_ID, ACTN_RQST_CD, APPR_PLCY, OBJ_ID, PRIO, RSP_ID, NM, TYP, VER_NBR, RULE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
          	bind => [2029, K, F, 6166CBA1BC00644DE0404F8189D86C09, 1, 2028, edu.sampleu.travel.workflow.EmployeeAttribute!director, R, 1, 1051]
          
          Show
          Jonathan Keller added a comment - Might be having code refresh issues - but I'm still bothered that there is anything which would cause these SQL when attempting to add a line: [EL Fine]: 2014-03-04 11:28:00.094--ClientSession(1383238319)--Connection(1575948658)-- Thread ( Thread [http-bio-8080-exec-3,5,main])--UPDATE KREW_RULE_T SET RULE_TMPL_ID = ?, VER_NBR = ? WHERE ((RULE_ID = ?) AND (VER_NBR = ?)) bind => [1030, 1, 1051, 0] [EL Fine]: 2014-03-04 11:28:00.096--ClientSession(1383238319)--Connection(1575948658)-- Thread ( Thread [http-bio-8080-exec-3,5,main])--INSERT INTO KREW_RULE_RSP_T (RULE_RSP_ID, ACTN_RQST_CD, APPR_PLCY, OBJ_ID, PRIO, RSP_ID, NM, TYP, VER_NBR, RULE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) bind => [2029, K, F, 6166CBA1BC00644DE0404F8189D86C09, 1, 2028, edu.sampleu.travel.workflow.EmployeeAttribute!director, R, 1, 1051]
          Hide
          Jonathan Keller added a comment - - edited

          Turns out some of the JPA annotations date back to 2009 and are not quite how we have been setting them up recently. So - I updated some on the classes and got a little farther.

          Now - I'm getting the same error, but on the KREW_RTE_NODE_T table...Attempting to add a line is causing an update to the route node definitions for KualiDocument!

          (2680 is KualiDocument - 2683 is TravelRequest)

          [EL Fine]: 2014-03-06 08:49:04.931--ServerSession(813692880)--Connection(511773481)--Thread(Thread[http-bio-8080-exec-5,5,main])--SELECT DOC_TYP_ID FROM KREW_DOC_TYP_T WHERE (DOC_TYP_ID = ?)
          	bind => [2680]
          [EL Fine]: 2014-03-06 08:49:04.932--ClientSession(1283476551)--Connection(2064642189)--Thread(Thread[http-bio-8080-exec-5,5,main])--UPDATE KREW_DOC_TYP_T SET OBJ_ID = ?, DOC_SEARCH_HELP_URL = ?, HELP_DEF_URL = ?, VER_NBR = ? WHERE ((DOC_TYP_ID = ?) AND (VER_NBR = ?))
          	bind => [697ae208-f2df-41d3-bd39-abe6fc84d573, , , 3, 2683, 2]
          [EL Fine]: 2014-03-06 08:49:04.933--ClientSession(1283476551)--Connection(2064642189)--Thread(Thread[http-bio-8080-exec-5,5,main])--INSERT INTO KREW_RTE_NODE_T (RTE_NODE_ID, ACTVN_TYP, GRP_ID, FNL_APRVR_IND, VER_NBR, MNDTRY_RTE_IND, NEXT_DOC_STAT, TYP, RTE_MTHD_CD, RTE_MTHD_NM, NM, DOC_TYP_ID, BRCH_PROTO_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
          	bind => [2840, S, null, 0, 1, 0, null, org.kuali.rice.kew.engine.node.InitialNode, null, null, PreRoute, 2680, null]
          
          Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2840' for key 'PRIMARY'
          Error Code: 1062
          Call: INSERT INTO KREW_RTE_NODE_T (RTE_NODE_ID, ACTVN_TYP, GRP_ID, FNL_APRVR_IND, VER_NBR, MNDTRY_RTE_IND, NEXT_DOC_STAT, TYP, RTE_MTHD_CD, RTE_MTHD_NM, NM, DOC_TYP_ID, BRCH_PROTO_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
          	bind => [2840, S, null, 0, 1, 0, null, org.kuali.rice.kew.engine.node.InitialNode, null, null, PreRoute, 2680, null]
          Query: InsertObjectQuery(RouteNode[routeNodeName=PreRoute, nodeType=org.kuali.rice.kew.engine.node.InitialNode, activationType=S]); nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
          
          Show
          Jonathan Keller added a comment - - edited Turns out some of the JPA annotations date back to 2009 and are not quite how we have been setting them up recently. So - I updated some on the classes and got a little farther. Now - I'm getting the same error, but on the KREW_RTE_NODE_T table...Attempting to add a line is causing an update to the route node definitions for KualiDocument! (2680 is KualiDocument - 2683 is TravelRequest) [EL Fine]: 2014-03-06 08:49:04.931--ServerSession(813692880)--Connection(511773481)-- Thread ( Thread [http-bio-8080-exec-5,5,main])--SELECT DOC_TYP_ID FROM KREW_DOC_TYP_T WHERE (DOC_TYP_ID = ?) bind => [2680] [EL Fine]: 2014-03-06 08:49:04.932--ClientSession(1283476551)--Connection(2064642189)-- Thread ( Thread [http-bio-8080-exec-5,5,main])--UPDATE KREW_DOC_TYP_T SET OBJ_ID = ?, DOC_SEARCH_HELP_URL = ?, HELP_DEF_URL = ?, VER_NBR = ? WHERE ((DOC_TYP_ID = ?) AND (VER_NBR = ?)) bind => [697ae208-f2df-41d3-bd39-abe6fc84d573, , , 3, 2683, 2] [EL Fine]: 2014-03-06 08:49:04.933--ClientSession(1283476551)--Connection(2064642189)-- Thread ( Thread [http-bio-8080-exec-5,5,main])--INSERT INTO KREW_RTE_NODE_T (RTE_NODE_ID, ACTVN_TYP, GRP_ID, FNL_APRVR_IND, VER_NBR, MNDTRY_RTE_IND, NEXT_DOC_STAT, TYP, RTE_MTHD_CD, RTE_MTHD_NM, NM, DOC_TYP_ID, BRCH_PROTO_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) bind => [2840, S, null , 0, 1, 0, null , org.kuali.rice.kew.engine.node.InitialNode, null , null , PreRoute, 2680, null ] Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2840' for key 'PRIMARY' Error Code: 1062 Call: INSERT INTO KREW_RTE_NODE_T (RTE_NODE_ID, ACTVN_TYP, GRP_ID, FNL_APRVR_IND, VER_NBR, MNDTRY_RTE_IND, NEXT_DOC_STAT, TYP, RTE_MTHD_CD, RTE_MTHD_NM, NM, DOC_TYP_ID, BRCH_PROTO_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) bind => [2840, S, null , 0, 1, 0, null , org.kuali.rice.kew.engine.node.InitialNode, null , null , PreRoute, 2680, null ] Query: InsertObjectQuery(RouteNode[routeNodeName=PreRoute, nodeType=org.kuali.rice.kew.engine.node.InitialNode, activationType=S]); nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
          Hide
          Jonathan Keller added a comment -

          I found the "cause".

          The maintainable addNewLineToCollection causes a refresh on all possibly affected reference objects. This ultimately calls "refresh" on the DocumentType object, which then attempts to retrieveNonKeyFields for the object, when then calls into the KEWModuleService.getExternalizableBusinessObject() which assumes that the DocumentType object retrieved could be a DTO, so it needs to convert it into a DocumentType BO, which calls the from method on document type which sets the document search help URL, marking it as dirty.

          So, then, when the next time the session is flushed, it blows up, apparently not having the children properly initialized with the right version number.

          Show
          Jonathan Keller added a comment - I found the "cause". The maintainable addNewLineToCollection causes a refresh on all possibly affected reference objects. This ultimately calls "refresh" on the DocumentType object, which then attempts to retrieveNonKeyFields for the object, when then calls into the KEWModuleService.getExternalizableBusinessObject() which assumes that the DocumentType object retrieved could be a DTO, so it needs to convert it into a DocumentType BO, which calls the from method on document type which sets the document search help URL, marking it as dirty. So, then, when the next time the session is flushed, it blows up, apparently not having the children properly initialized with the right version number.
          Hide
          Jonathan Keller added a comment -

          Making some progress. Commenting out the refresh() methods on DocumentType and RuleBaseValues seems to have helped.

          Now the problem is that, since we can't call WebRuleUtils.translateResponsibilitiesForSave before workflow routing, we need to alter the rules to work with the data in their "web" locations.

          That's been (at least partially) done and the document now submits and route to final.

          It does not however actually save any of the information and may actually delete the responsibilities which are there. So, something is still not getting persisted properly.

          Show
          Jonathan Keller added a comment - Making some progress. Commenting out the refresh() methods on DocumentType and RuleBaseValues seems to have helped. Now the problem is that, since we can't call WebRuleUtils.translateResponsibilitiesForSave before workflow routing, we need to alter the rules to work with the data in their "web" locations. That's been (at least partially) done and the document now submits and route to final. It does not however actually save any of the information and may actually delete the responsibilities which are there. So, something is still not getting persisted properly.
          Hide
          Jonathan Keller added a comment -

          Huh - the collection contents are not getting back to the object when I attempt to route. So, the loss is before the route even takes place.

          Show
          Jonathan Keller added a comment - Huh - the collection contents are not getting back to the object when I attempt to route. So, the loss is before the route even takes place.

            People

            • Assignee:
              Jonathan Keller
              Reporter:
              Eric Westfall
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Agile

                    Structure Helper Panel