ObjectStoreValidationTst

From: Gili (cowwo..bs.darktech.org)
Date: Thu Sep 15 2005 - 01:03:27 EDT

  • Next message: Benjamin Podszun: "Adding new details to a running cayenne persistence system"

    Hi,

            ObjectStoreValidationTst tests for what happens if a new object is
    registered by validateForSave() but it does not test what happens if a
    registered object is unregistered.

            I wanted to register a hook to run right before commit which would
    canonicalize all my NEW objects. The result of this is that some objects
    that were first thought to be NEW are discovered to be already COMMITED
    and so they are removed from the newObjects() list.

            The problem is that with the current implementation validateForInsert()
    gets invoked on objects that were unregistered by previous calls to
    validateForInsert()... That is, validateForInsert() gets invoked on
    unregistered objects... This in turn ends up dieing horribly because the
    validator code expects only registered objects to get validated.

            Anyway, I would suggest the following:

    1) Update ObjectStoreValidationTst to test for this condition.

    2) Provide a more extensive contract in the validateForXXX() Javadoc.
    Explain what is or is not allowed to occur within these methods.

    3) It would be nice if there was a hook that gets invoked before commit
    -- like validateForXXX() -- but which allows one to safely register or
    unregister objects. Please consider either updating validateForXXX() so
    it is safe for these kinds of operations or add a new hook for that same
    task.

            What do you think?

    Gili

    -- 
    http://www.desktopbeautifier.com/
    



    This archive was generated by hypermail 2.0.0 : Thu Sep 15 2005 - 01:03:29 EDT