RES: RES: Update problem

From: Reinaldo Coelho Sartorelli (reinaldo.sartorell..ES.com)
Date: Wed Jan 19 2005 - 14:29:32 EST

  • Next message: Reinaldo Coelho Sartorelli: "RES: Update problem"

    Tks Mike, itīs a problem.

    :-)

    Now is Ok :-)

    Tks

    -----Mensagem original-----
    De: Mike Kienenberger [mailto:mkienen..laska.net]
    Enviada em: quarta-feira, 19 de janeiro de 2005 17:17
    Para: cayenne-use..bjectstyle.org
    Cc: Reinaldo Coelho Sartorelli
    Assunto: Re: RES: Update problem

    Reinaldo Coelho Sartorelli <reinaldo.sartorell..ES.com> wrote:
    > I dont use registerNewObject(system) because this is a update and not a
    insert command.
    > This object have a oid registred!!!

    If it's already registered in con, you don't need to register it again.

    If it's registered in another DataContext, either use that old DataContext
    instead of con

            oldCon = system.getDataContext();

    or copy it into con using con.localObjects();

    It's true that localObjects() calls registeredObject() internally, but it
    also performs other checks and optimizations at the same time.

    Registering a modified object in another DataContext is disallowed by
    localObjects(), and that's probably why your update isn't working if con is
    a different DataContext.

    registeredObject() creates a new system object marked HOLLOW, so all of your
    changes will be lost.

    If you're bound and determined to register a modified object in another
    DataContext via registeredObject(), you'll need to manually copy all of the
    properties off the old object and onto the new object.

    You'll have to use a method on the system class to copy it as system's
    values Map (containing all of its properties) is marked protected.

    -Mike

    ________________________________________________________________________
    This email has been scanned for all viruses by the MessageLabs service.

    ________________________________________________________________________
    This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-Mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-Mail and delete this e-Mail from your system. Unless explicitly and conspicuously stated in the subject matter of the above e-Mail, this e-Mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-Mail does not constitute consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties.

    This email has been scanned for all viruses by the MessageLabs service.



    This archive was generated by hypermail 2.0.0 : Wed Jan 19 2005 - 14:29:26 EST