Re: Weird behavior (M5)

From: Nick Stuart (nicholas.stuar..mail.com)
Date: Fri Aug 19 2005 - 19:08:56 EDT

  • Next message: Andrus Adamchik: "Re: Weird behavior (M5)"

    Sorry, knew I should of posted more. All i do to add the blocks to
    both a page and a template is say something like:

    block.setPage(page); //or template (whatever may be the case)

    in my pf/create() method I simply have a loop that calls for each
    block ion the template :

    List list = template.getBlocks();

    it loops over the above list and adds new page blocks to a page.

    Doing a list.size() here is showing me 4 (where it should only be 2!)
    and so adds 4 blocks when there should only be 2. So I am not sure
    whats going on. I'm not doing anything fancy, and as I said,
    everything is generated in the database fine, except the page has
    duplicate entries added to it because something is acting screwy here.
    I used the modeler to generate the classes/schema with no problems or
    errors there.

    Thanks for the help!
    -Nick

    On 8/19/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > No idea what's wrong, as the code example that you posted uses your
    > own methods to setup relationships. Also it is not clear whether
    > template.getBlocks() and page.getBlocks() are generated methods for
    > mapped relationships or methods with custom logic (?)
    >
    > I guess the easiest way to detect what's wrong is to run this block
    > of code in debugger and step through the suspect methods.
    >
    > Andrus
    >
    >
    > On Aug 19, 2005, at 8:52 PM, Nick Stuart wrote:
    >
    > > Hi all, playing around with Release M5 and am having a weird problem
    > > with some toMany relationships.
    > >
    > > Here's the test code:
    > > template = tf.create("TestPageTemplate", false, ctx);
    > > assertNotNull(template);
    > > tf.addBlock(template, "Block1PageCreate", ctx);
    > > tf.addBlock(template, "Block2PageCreate", ctx);
    > > //assertEquals(2, template.getBlocks().size());
    > >
    > > CmsPage page = pf.create(template, name, description, ctx);
    > > assertNotNull(page);
    > > assertEquals(name, page.getName());
    > > assertEquals(description, page.getDescription());
    > > assertEquals(template, page.getTemplate());
    > > System.out.println("****** " + template.getBlocks().size() + "
    > > -- " + page.getBlocks().size());
    > >
    > > Now if I leave the first assertEquals(2,...) commented out I get a
    > > print out of ******* 4 --- 4. Hmmm...interesting. BUT if I uncomment
    > > the first assert I get a print out showing 2 -- 2 as I would expected!
    > > Whats up with that? The database only shows that the 2 template blocks
    > > have been created, but 4 show up in the list, and 4 show up in the
    > > page blocks! Doh!
    > >
    > > I believe I'm adding stuff correctly to the ctx/objects/whatever as
    > > its all showing up and acts correctly with that assert
    > > uncommented....any ideas?
    > >
    > > -Nick
    > >
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Aug 19 2005 - 19:08:57 EDT