Re: weird behaviour with commit?

From: Kevin Menard (kmenar..ervprise.com)
Date: Fri Aug 05 2005 - 08:52:01 EDT

  • Next message: Mike Kienenberger: "Re: weird behaviour with commit?"

    Mike Kienenberger wrote:

    > Do you have both y and x in the same dc?
    > Probably not. By default, y.setToMyClass(x) will try to convert x to y's
    > dc if they are not the same.
    > Since x is only a temporary object until it's committed, it probably won't
    > survive the conversion.
    >
    > Try using:
    >
    > x = y.getDataContext().createAndRegisterNewObject(MyClass.class);

    Actually, it's even easier than that. If y is already registered with a
    data context, there's no need to explicitly register x.

    x = new MyClass();
    y.setToMyClass(x);

    This will auto-register x with y's data context.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Fri Aug 05 2005 - 08:51:21 EDT