db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl <thomas.vand...@tewisoft.de>
Subject Re: silent db hit for associated objects
Date Thu, 08 Sep 2005 14:31:16 GMT
Thomas Vandahl wrote:
> Not without bigger changes in the AbstractBaseManager. I will have a 
> look at this. I guess the real fun starts if I want to cache the whole 
> collection of books at once (using MethodResultCache for example, not to 
> speak of invalidation).

Replying to myself is fun...

Well, I finally came up with an attempt for a solution. It was less work 
than I expected, but I guess we are only halfway through. It passes the 
runtime test, however.

It looks like this:
public Author getAuthor(Connection connection)
     throws TorqueException
     if (aAuthor == null && (this.authorId != 0))
         aAuthor = 
         if (aAuthor == null)
             aAuthor = 
AuthorPeer.retrieveByPK(SimpleKey.keyFor(this.authorId), connection);
     return aAuthor;

While I was at it I corrected a few problems PMD complained about, but 
there is still room for improvement... :-)

Any comments are welcome.

Bye, Thomas.

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message