开发者

Retrieve JDO object without certain attribute

I have a class Post and within it I have a list of Reviews. Is it possible to retrieve a Post object without reviewList (or as an empty list)? Or maybe I should use some other model to achieve this.

@PersistenceCapable
class Post {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   long id;

   @Persistent
   String title;

   @Persistent
   Li开发者_开发问答st<Review> reviewList;
}

.

@PersistenceCapable
class Review {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   long id;

   @Persistent
   String comment;
}


The documentation says:

Accessing a collection performs a query

I read this as: the collection is lazy-loaded. This means that when you load a Post, its reviews are not laoded. They will be loaded automatically when you access the collection (i.e. when calling any method of the collection).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜