开发者

How can I load a property lazily in JDO (on Google App Engine)?

开发者 https://www.devze.com 2022-12-19 20:28 出处:网络
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 nee

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消