-
1. Re: Needing help for the lazy initialize
seto Feb 17, 2007 3:19 AM (in response to seto)I just have a three level relationship.
Category 1...* Position 1...* Article
My home page is listing the categories with the position below and articles below. I want to limit the size initilize size of the articles. I'm using the sublist to get the recent 10 articles. But it can't limit the initilize and the performance is so bad. -
2. Re: Needing help for the lazy initialize
seto Feb 17, 2007 10:42 AM (in response to seto)Can someone help me? I learn from the blog use the sublist, I'm in trouble with rows up to 1000. It cost seconds to finish the loading.
-
3. Re: Needing help for the lazy initialize
seto Feb 17, 2007 11:02 AM (in response to seto)for example
<ul> <ui:repeat value="#{catgories}" var="catgory"> <li>#{category.name}</li> <ul> <ui:repeat value="#{catgory.positions}" var="position"> <li>#{position.name}</li> <ul> <ui:repeat value="#{position.articles}" var="article"> <li>#{article}</li> </ui:repeat> </ul> </ui:repeat> </ul> <ui:repeat> </ul>
Refering to the blog example, I used the #{position.recentArticles} instead.public List getRecentArticles(){ return articles.sublist(0, 10);//just a example so ignore the length problem }
But it also initilized the other articles. And it cause the performance leak. And I want to limit the initialization of the articles. I want it just initilize the recent 10 articles. How can I do that? -
4. Re: Needing help for the lazy initialize
lawrieg Feb 17, 2007 11:40 AM (in response to seto)Take a look at section 8.4 'Using the JPA "delegate"' and 8.5 'Using Hibernate filters' in the Seam reference documentation - it seems like this might be what you are looking for.
Hope this helps,
Lawrie -
5. Re: Needing help for the lazy initialize
gavin.king Feb 17, 2007 11:55 AM (in response to seto)There's no support for this in EJB3. Just use an ordinary query.
-
6. Re: Needing help for the lazy initialize
seto Feb 17, 2007 12:36 PM (in response to seto)lawrieg, thanks. Youre advice helps. I just use the session to implement the part initialize of the collection. Thank you.
Also thanks to gavin.