-
1. Re: Unnecessary table join from EJB-QL
juhalindfors May 7, 2003 6:07 AM (in response to nicknewman)Have you declared load-groups and set eager-loading and lazy loading groups for your columns? Have a look at the CMP doc for details.
-
2. Re: Unnecessary table join from EJB-QL
nicknewman May 7, 2003 3:45 PM (in response to nicknewman)No, I haven't done that. I wouldn't expect it to change the table-join that JBoss is generating, but it's certainly worth checking.
Thanks -
3. Re: Unnecessary table join from EJB-QL
nicknewman May 19, 2003 2:36 PM (in response to nicknewman)In case anyone else is interested I'll post the answer which I eventually came up with myself.
Instead of using a finder on Book looking something like this:
bookHome.findByAuthorPk( authorPk );
use a finder on the Author and then ask for his books, something like this:
authorHome.findByPrimaryKey( authorPk ).getBooks();
or, possibly better yet (because it is more flexible) change the book finder to take an Author rather than a primary key, like this:
Author author =
authorHome.findByPrimaryKey( authorPk );
bookHome.findByAuthor( author );
Both of these solutions perform an Author lookup which might be considered unnecessary, but this is better than a table join.
Nick