GAE/JDO: How to check whether a field in a detached object was loaded

Posted by tempy on Stack Overflow See other posts from Stack Overflow or by tempy
Published on 2010-03-21T17:29:27Z Indexed on 2010/03/21 17:31 UTC
Read the original article Hit count: 602

Filed under:
|
|

My DAO detaches and then caches certain objects, and it may retrieve them with different fetch groups. Depending on which fetch group was used to retrieve the object, certain fields of that object may be available, or not. I would like to be able to test whether a given field on that object was loaded or not, but I can't simply check whether the field is null because that results in a "JDODetachedFieldAccessException" which demands that I either not access the field or add detach the field first.

I could always catch that exception, but that doesn't smell right. So, does anyone know whether its possible to check if the field was detached?

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about jdo