> I see what you're saying (I think). So should it always use a PreCache
> QueryParam?
Let's say you have some code like so:
author.books.flatMap(book => {
bind("foo", xhtml, "title" -> book.title, "author" -> book.author.name);
})
If you have 10 books for a given author this will generate 10 queries
to the database (as it fills in the author field for each book).
You can improve on that by including a PreCache QueryParam in the
MappedOneToMany field, then you'll get a single query sent to the DB
that looks something like this:
SELECT DISTINCT authors.id, authors.name FROM authors WHERE id IN
(SELECT authorid FROM books WHERE authorid = 111);
But even that query shouldn't be necessary (if the OneToMany code was
smarter) as the author for all the books in question is the top level
object that the books field lives on.
-harryh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---