Re: Hollow object after fetch and move to new DataContext

From: Julius Spencer (juliu..sa.co.nz)
Date: Wed Apr 28 2010 - 04:05:03 EDT

  • Next message: Andrus Adamchik: "Re: Hollow object after fetch and move to new DataContext"

    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:06:04 EDT