• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDO: Lazy Read ?

 
Rama Raghavan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does JDO populate the oject from database as you traverse thru the object relationship or is the whole object (including all the relations for that object) retrieved as one invocation..?
 
David Jordan
Author
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which fields of an object are read depends on whether they are in something called the default fetch group, which is the fields initialized at first when the object is accessed. Other fields can be initialized as they are accessed. When a reference field is initialized, it is set to reference the referenced object. So the referenced object is allocated in the cache, but the implementation does not have to actually read the object until an attempt is made to read one of its fields.
 
David Tinker
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDO vendors can do a lot of optimization in this area without going outside of the spec. JDO Genie can prefetch instances using outer joins and so on. Also we will load the whole row at once by default as this is nearly always the best strategy for a relational store. The fields in your instances are always populated strictly according to spec. We just cache extra information avoid reduce the number of SQL queries.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic