12 Replies Latest reply on Mar 13, 2013 6:21 AM by Oliver Zhou

    MODE-1822 - VersionManager.checkin throws exception in the transaction when using JTA transaction manager

    Oliver Zhou Newbie

      Hi Randall,

       

      I re-tested this issue with latest 3.1.3, the bug is fixed. Thanks.

       

      But I found another issue may relate to this fix.

       

      RIght after calling the function described in the issue, I call the following code to query the content that persist just now

       

      public void testCreateNewNode() {
          .....
          createNewNode(sessionHolder);
          Query query = sessionHolder.getSession().getWorkspace().getQueryManager().createQuery("SELECT * FROM [pd:product]", Query.JCR_SQL2);
          System.out.println(query.execute().toString());
      }
      
              @Transactional
              public void createNewNode(JCRSessionHolder sessionHolder) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException {
                  VersionManager vm = sessionHolder.getSession().getWorkspace().getVersionManager();
      
                  Node node = sessionHolder.getSession().getRootNode().addNode("Test3", "pd:product");
                  node.addMixin("mix:versionable");
                  node.setProperty("name", "lalalal");
                  node.setProperty("code", "lalalal");
                  sessionHolder.getSession().save();
                  vm.checkin(node.getPath());
              }
      
      

       

      The chances are high to get the duplicated result. But not every time.

       

      +---+-----------------+-----------------+----------------------------------+---------------------------------------------+---------------------+---------------------+----------------------+---------------------------+-----------------------+---------------------------------------------------------------+--------------------+
      | # | pd:product.name | pd:product.code | pd:product.jcr:primaryType       | pd:product.jcr:mixinTypes                   | pd:product.jcr:path | pd:product.jcr:name | pd:product.jcr:score | pd:product.mode:localName | pd:product.mode:depth | Location(pd:product)                                          | Score(pd:product)  |
      +---+-----------------+-----------------+----------------------------------+---------------------------------------------+---------------------+---------------------+----------------------+---------------------------+-----------------------+---------------------------------------------------------------+--------------------+
      | 1 | lalalal         | lalalal         | {http://www.ozhou.com/pd}product | {http://www.jcp.org/jcr/mix/1.0}versionable | /{}Test3            | {}Test3             |                      | Test3                     | 1                     | /{}Test3 @ 8c3fc847505d64ce92d520-8927-4d8b-9389-53099a315930 | 3.4474973678588867 |
      | 2 | lalalal         | lalalal         | {http://www.ozhou.com/pd}product | {http://www.jcp.org/jcr/mix/1.0}versionable | /{}Test3            | {}Test3             |                      | Test3                     | 1                     | /{}Test3 @ 8c3fc847505d64ce92d520-8927-4d8b-9389-53099a315930 | 3.4474973678588867 |
      +---+-----------------+-----------------+----------------------------------+---------------------------------------------+---------------------+---------------------+----------------------+---------------------------+-----------------------+---------------------------------------------------------------+--------------------+