Re: force update

From: Koen Segers (KoenSeger..carlet.be)
Date: Sat Jun 04 2005 - 19:48:31 EDT

  • Next message: Koen Segers: "Re: force update"

    On Sunday 05 June 2005 01:11, Andrus Adamchik wrote:
    > > How can i force an update?
    >
    > Change an object in question and then call "DataContext.commitChanges
    > ()" - that's it. If you can elaborate more on the details of what you  
    > are doing, myself or someone else may spot possible problems.

    I used the commitchanges.
    Explain what I'm doing... Not so easy, but I'll try.
    I have table of sections.
    Sections have subsections en so on... This way i have created a tree in my
    database. This tree must be printed in a javascript tree.

    Still with me?

    The tree must be printen in correct order. Therefore I created a function that
    sorts the tree. All this works perfectly.

    The problem is now when I add a new section. Sometimes (I don't see any
    particular scheme) it is inserted in the tree, sometimes not...

    I checked with phpPgAdmin (yeah it's a postgres db) and the new section is
    added to the db. So far so good!
    I checked my html and the problem isn't in the java script tree. It just ins't
    inserted in the tree.
    Then I did an update of the page containing the tree and checked with ethereal
    what transactions with my DB occurred. None...

    Could the problem be the fact that i use my own list (the sorted one)...

    Here's the sorted list algo:
    /**
             *
             *..eturn List of all child sections (of the baselayer) sorted by their
    sectionNumber.
             */
            synchronized public List getSortedSectionArray(){
                    List unsortedList = new LinkedList();
                    List unsortedFullList = getSectionArray();
                    Iterator i = unsortedFullList.iterator();
                    while (i.hasNext()){
                            Section s = (Section) i.next();
                            if ((s.getToLayer().isBaseLayer())){
                                            unsortedList.add(s);
                            }
                    }
                    Collections.sort(unsortedList,
                                    new Comparator(){
                                            public int compare(Object arg0, Object arg1) {
                                                    Section section0 = (Section)arg0;
                                                    Section section1 = (Section) arg1;
                                                    return
    section0.getSectionnumber().intValue()-section1.getSectionnumber().intValue();
                                            }
                                            
                                    }
                    );
                    return unsortedList;
            }

    >
    > > I checked with ethereal if there were any transactions to my database.
    >
    > Wow! Probably the first time I hear of using Ethereal to debug DB  
    > interactions (now I want to try it out myself :-)). I would also  
    > advise to check application log generated by Cayenne - http://
    > objectstyle.org/cayenne/userguide/deploy/logging.html

    Where do I put this rule?
    log4j.logger.org.objectstyle.cayenne.access.QueryLogger = INFO

    >
    > Andrus

    Thx for the help!

    -- 
    

    Koen Segers

    <koenseger..carlet.be> <http://eddyvite.dyndns.org>



    This archive was generated by hypermail 2.0.0 : Sat Jun 04 2005 - 19:48:40 EDT