You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Peder Nordvaller <pe...@vitaminapplications.se> on 2004/09/20 22:56:58 UTC

Weird behaviour in transaction

I'm using Slide 2.1b1 and MySql41RDBMSAdapter to a 4.1 MySQL nodestore, securitystore, lockstore, revisiondescriptorstore and revisiondescriptorsstore.

When performing the following commands towards the slide helpers (ommitting irrelevant code):


        token.begin();       // Start transaction

        collection = new SubjectNode( "/files/test");
        revisionDescriptor = new NodeRevisionDescriptor();
          ... fill up revisionDescriptor...
        structure.create(slideToken, collection, "/files/test");
        content.create(slideToken, "/files/test", revisionDescriptor, null);

        collection = new SubjectNode( "/files/test/sub1");
        revisionDescriptor = new NodeRevisionDescriptor();
          ... fill up revisionDescriptor...
        structure.create(slideToken, collection, "/files/test/sub1");
        content.create(slideToken, "/files/test", revisionDescriptor, null);

        collection = new SubjectNode( "/files/test/sub2");
        revisionDescriptor = new NodeRevisionDescriptor();
          ... fill up revisionDescriptor...
        structure.create(slideToken, collection, "/files/test/sub2");
        content.create(slideToken, "/files/test", revisionDescriptor, null);

        token.commit();

All the nodes are created just fine, as they should, but only the last node under /files/test (/files/test/sub2) is added as a child to /files/test. (this is the only one that ends up in the BINDING table). If I manually add a row in the BINDING table to link the other node (/files/test/sub1) it is listed - but shouldn't the transaction be able to handle this scenario?

Another issue (well, kinda) I have is when I do two changes to a node and do content.store() on it within a single transaction (pseudocode):

    token.begin();
    nrd = content.retrieve("/files/test");
    .. change NodeRevisionDescriptor..
    content.store(nrd,"/files/test");
    nrd = content.retrieve("/files/test");
    .. change NodeRevisionDescriptor again
    content.store(nrd,"/files/test");
    token.commit();    

This time only the last change is actually stored in the database. Now, this one I probably could understand as I overwrite the change before I actually do the commit, but it was a bit unclear when I only added new properties to the NodeRevisionDescriptor thinking that they both would be added in the commit?

Regards, Peder


        

Re: Weird behaviour in transaction

Posted by Peder Nordvaller <pe...@vitaminapplications.se>.
Anyone?

----- Original Message ----- 
From: "Peder Nordvaller" <pe...@vitaminapplications.se>
To: "Slide Users Mailing List" <sl...@jakarta.apache.org>
Sent: Monday, September 20, 2004 10:56 PM
Subject: Weird behaviour in transaction


I'm using Slide 2.1b1 and MySql41RDBMSAdapter to a 4.1 MySQL nodestore, 
securitystore, lockstore, revisiondescriptorstore and 
revisiondescriptorsstore.

When performing the following commands towards the slide helpers (ommitting 
irrelevant code):


        token.begin();       // Start transaction

        collection = new SubjectNode( "/files/test");
        revisionDescriptor = new NodeRevisionDescriptor();
          ... fill up revisionDescriptor...
        structure.create(slideToken, collection, "/files/test");
        content.create(slideToken, "/files/test", revisionDescriptor, null);

        collection = new SubjectNode( "/files/test/sub1");
        revisionDescriptor = new NodeRevisionDescriptor();
          ... fill up revisionDescriptor...
        structure.create(slideToken, collection, "/files/test/sub1");
        content.create(slideToken, "/files/test", revisionDescriptor, null);

        collection = new SubjectNode( "/files/test/sub2");
        revisionDescriptor = new NodeRevisionDescriptor();
          ... fill up revisionDescriptor...
        structure.create(slideToken, collection, "/files/test/sub2");
        content.create(slideToken, "/files/test", revisionDescriptor, null);

        token.commit();

All the nodes are created just fine, as they should, but only the last node 
under /files/test (/files/test/sub2) is added as a child to /files/test. 
(this is the only one that ends up in the BINDING table). If I manually add 
a row in the BINDING table to link the other node (/files/test/sub1) it is 
listed - but shouldn't the transaction be able to handle this scenario?

Another issue (well, kinda) I have is when I do two changes to a node and do 
content.store() on it within a single transaction (pseudocode):

    token.begin();
    nrd = content.retrieve("/files/test");
    .. change NodeRevisionDescriptor..
    content.store(nrd,"/files/test");
    nrd = content.retrieve("/files/test");
    .. change NodeRevisionDescriptor again
    content.store(nrd,"/files/test");
    token.commit();

This time only the last change is actually stored in the database. Now, this 
one I probably could understand as I overwrite the change before I actually 
do the commit, but it was a bit unclear when I only added new properties to 
the NodeRevisionDescriptor thinking that they both would be added in the 
commit?

Regards, Peder





---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org