Re: [castor-user] lazy mappings always load their data

2013-07-08 Thread Justin Case
Hi Werner,
I had the code wrapped in a template project to open a bug, then I noticed I 
can't reproduce it either. No idea what happened all this time. If it ever 
becomes reproductible I'll let you know. 

Thanks a lot!
JC





 From: Werner Guttmann wgut...@codehaus.org
To: user@castor.codehaus.org 
Cc: Justin Case send_lotsa_spam_h...@yahoo.com 
Sent: Friday, June 28, 2013 2:28 PM
Subject: Re: [castor-user] lazy mappings always load their data
 

Hi Justin,

On 23.05.2013 20:56, Justin Case wrote:
 As a consequence, I would have expected that a lazy object if never
 accessed, will never be loaded into memory. This seems to not be the
 case. A code like the following:

How are you actually observing this behaviour ? I am really having 
problems to replay such scenario.

Thanks
Werner

 Thanks a lot,
 JC




Re: [castor-user] lazy mappings always load their data

2013-06-28 Thread Werner Guttmann

Hi Justin,

On 23.05.2013 20:56, Justin Case wrote:

Hello group,

I really don't get the idea of lazy loading. From the Castor site I
read the following:

Per definition, when an instance of Department is loaded through e.g.
Database.load(), Castor will not (pre-)load the Employee instance
referenced (as such reducing the size pf the initial query as well as
the size of the result set returned). Only when the Emplyoee instance is
accessed through Department.getEmployee(), Castor will load the actual
object into memory from the persistence store.
This means that if the Employee instance is not accessed at all, not
only will the initial query to load the Department object have had its
complexity reduced, but no performance penalty will be incurred for the
additional access to the persistence store either.

As a consequence, I would have expected that a lazy object if never
accessed, will never be loaded into memory. This seems to not be the
case. A code like the following:

 Database db = _jdo.getDatabase();
 db.begin();
 OQLQuery query = db.getOQLQuery(SELECT product FROM  +
Product.class.getName() +  product WHERE id = $1);
 query.bind(new Integer(1));
 QueryResults results = query.execute(AccessMode.ReadOnly);
 Product product = (Product) results.next();
 db.commit();
 db.close();

will load all the lazy mappings from the Product class (1:1 or whatever)
during the commit() phase.
Am I getting something wrong, or is it by design so?
How are you actually observing this behaviour ? I am really having 
problems to replay such scenario.


Thanks
Werner


Thanks a lot,
JC


-
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email