Re: Hollow object after fetch and move to new DataContext

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Apr 28 2010 - 04:18:08 EDT

  • Next message: Andrew Lindesay: "Broken Link"

    Definitely odd. This line should trigger object inflation and turning
    it to committed state:

    > String code = si.getUser().getUserType().getCode();

    Maybe worth running in debugger to see what's really going on... Maybe
    something from CayenneDataObject got overridden, etc. Specifically
    check BaseContext.prepareForAccess(..) method that should handle
    inflating the object.

    Andrus

    On Apr 28, 2010, at 4:05 PM, Julius Spencer wrote:

    > Hi Andrus,
    >
    > Thank you for the response. Here is the code taking a user and
    > putting it into the SessionInfo.
    >
    > TCMSessionInfo si = (TCMSessionInfo)
    > getContext().getSessionInfo(false);
    > si = (TCMSessionInfo) getContext().getSessionInfo(true);
    > si.setUser((TCMUser)
    > si.getDefaultDataContext().localObject(user.getObjectId(), null));
    >
    > later I check that there is a user in the session, but when I try to
    > get a related DataObject:
    >
    > TCMSessionInfo si = (TCMSessionInfo)
    > cdrContext.getExistingSessionInfo();
    > if(null!=si.getUser())
    > String code = si.getUser().getUserType().getCode();
    >
    > the the user appears to look like this:
    > {<ObjectId:TCMUser, ZID=200>; hollow; []}
    >
    > Thanks for any advice.
    >
    >
    > On 28/04/2010, at 7:51 PM, Andrus Adamchik wrote:
    >
    >> Hi Julius,
    >>
    >> How was it "shifted" to a new context? Maybe you can provide some
    >> sample code?
    >>
    >> Andrus
    >>
    >> On Apr 28, 2010, at 11:37 AM, Julius Spencer wrote:
    >>
    >>> Hi,
    >>>
    >>> I'm a new user of Cayenne and I have a problem with an object I'm
    >>> not expecting to be "hollow".
    >>>
    >>> I am using STABLE-3.0 and have fetched a DataObject then shifted
    >>> it to a new DataContext and then it seems to stay HOLLOW even
    >>> after querying a to-one relationship.
    >>>
    >>> Just wondering if anyone has come across this or maybe it's a
    >>> common mistake.
    >>>
    >>> Regards,
    >>> Julius.
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Apr 28 2010 - 04:19:02 EDT