How can I load a property lazily in JDO (on Google App Engine)?
I have this code in one of my @PersistenceCapable classes:
@Persistent
private Blob data;
The Blob
can be quite big, so开发者_Go百科 I'd like to load it lazily since most of the times I don't need it. How can I annotate that property to avoid immediate loading? I could create another class that contains the Blob
alone and then use a lazy one-to-one, but I'd like to solve this with annotations.
You can't: Entities in App Engine are loaded and stored in their entirety. If you want to avoid loading it, you'll need to, as you suggest, store it in a separate model. I would suggest benchmarking your app first to see if this is an issue, though.
精彩评论