MountainClimb / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

request for enabling trace of data store access (plus question on JDO lazy-loading behavior) #223

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sorry maybe what I request has already existed but I really couldn't find it in 
documentation. So raise the question here. 

ORM tools like Hibernate normally provide configuration to allow printing trace 
logs of each underline JDBC SQL executed behind the high-level API calls. 

I wonder if GAE provide the similar, printing trace logs of each data store 
access, at lease on development server environment. 

This is very useful in finding if the application's entity model design is good 
in terms of performance.

By the way, another question regarding on JDO's lazy-loading behavior. Say if I 
have an Owned One-to-One relationship, and I am trying to get the One side 
object's Key (not the other properties), will this cause a data store query at 
once? 

e.g. I have 

Class Brand {
    @Persistent
    DSFile logo;
}

Class DSFile {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
    private String pkId;

    @Persistent
    private Blob content;

    @Persistent
    private String fileName;
}

and when I access:

// will fetching of entire DSFile object? 
brand.getLogo().getPkId()

// or fetching of entire DSFile object(and the Blob content) only happens when 
accessing non-primary key field? 
brand.getLogo().getFileName()

Here fetching of Blob field could be expensive (right?) so I want to avoid it.

Similiar model implemented on Hibernate and RDBMS will not cause 2nd DB query 
when getPkId(), because the relationship is implemented as a forign column 
(logoFileId) which is in Brand Table itself.

Please comment? 

Thanks

Original issue reported on code.google.com by yongli2...@gmail.com on 31 Oct 2010 at 12:52

GoogleCodeExporter commented 8 years ago
SVN trunk logs all datastore access on category "DataNucleus.Datastore.Native" 
so easily able to trace access now

Original comment by googleco...@yahoo.co.uk on 16 Jul 2011 at 7:57