cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julius Spencer <jul...@msa.co.nz>
Subject Re: Hollow object after fetch and move to new DataContext
Date Wed, 28 Apr 2010 20:39:00 GMT
Hi,

Yeah I just didn't step into it so it looked hollow at that point.

Sorry about that...

Thank you for the help!

On 28/04/2010, at 8:18 PM, Andrus Adamchik wrote:

> 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.
>>> 
>> 
>> 
> 


Mime
View raw message