You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark <li...@mark-arnold.net> on 2006/05/28 09:58:17 UTC

List loaded twice from DB

Hi,

I have a simple CRUD scenario with a "ListPage" and a "ModifyPage".
The ListPage gets all records from the DB by calling the method 
"getAllRooms()" of a "RoomAdminService" and lists them in a table.
For some reason the query "select * from rooms" is executed twice every 
time the page is accessed.

getAllRooms() is only referenced once in the .page file to plug a page 
property, the .html file then references that property

I compared the StackTraces of the two calls, they have identical tops 
and bottoms, but differ somwhere in the middle:

        at $RoomListPage_3.finishLoad($RoomListPage_3.java)
        at 
org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:439)
        at 
org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:613)
        at $IPageLoader_10b79e6e7bf.loadPage($IPageLoader_10b79e6e7bf.java)
        at $IPageLoader_10b79e6e7c0.loadPage($IPageLoader_10b79e6e7c0.java)
        at 
org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:120)
        at $IPageSource_10b79e6e724.getPage($IPageSource_10b79e6e724.java)
        at 
org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:268)
        at 
org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:251)
        at 
org.apache.tapestry.engine.RequestCycle.activate(RequestCycle.java:609)
        at 
org.apache.tapestry.engine.PageService.service(PageService.java:66)
        at 
$IEngineService_10b79e6e7af.service($IEngineService_10b79e6e7af.java)
        at 
org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66)


and

        at $RoomListPage_3.pageDetached($RoomListPage_3.java)
        at 
org.apache.tapestry.AbstractPage.firePageDetached(AbstractPage.java:452)
        at org.apache.tapestry.AbstractPage.detach(AbstractPage.java:140)
        at 
org.apache.tapestry.pageload.PageSource.releasePage(PageSource.java:147)
        at 
$IPageSource_10b79e6e724.releasePage($IPageSource_10b79e6e724.java)
        at 
org.apache.tapestry.engine.RequestCycle.cleanup(RequestCycle.java:192)


So it seems like the first call comes out of the finishLoad(), while the 
second call is caused by pageDetached() of my ListPage.


Does anybody know why it would access the getAllRooms() twice?

Thanks,

MARK

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: List loaded twice from DB

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Hi Mark.

Confusion over initial-value used to be a regular topic here for
Tapestry beginners, but bot so much now. Resetting the property to
null is the default behaviour, so there should be no need to do this.

As for the "attach-value" idea, I haven't seen it discussed, but I
suspect it may have to do with the order of property initialization,
the rewind cycle etc just making this easier to code in Java.

Try asking your question on the dev list.

Cheers,
Nick.


Mark wrote:
> Hi Nick, thanks for this response.
> 
> The next question is probably to be decided by the Tapestry developers, 
> but maybe somebody else has some insights on this or knows if this has 
> been discussed before:
> 
> Would it not make more sense to be able to specify a "attach-value" and 
> a "detach-value" instead of a "initial-value"?
> This way I could explicitly specify two different values for the two 
> points in time of the page's lifecycle. I could do:
> 
> <property name="myList" attach-value="ognl:service.loadListFromDb()" 
> detach-value="ognl:null"/>
> 
> The reason being that it doesn't seem to make much sense to perform 
> resource-expensive operations like DB queries for cleanup AFTER the page 
> is used. As far as I understand, this post-use initialization is mainly 
> done to prevent data that belongs to one user from being "accidentally" 
> carried over to the next user.
> So setting the property to null when the page is returned to the pool 
> should be enough for that purpose. Especially since by the time the next 
> user gets the page from the pool, the cached value might long be outdated.
> 
> On the other hand, this idea sounds too simple for it to never have come 
> up before, so maybe there is a good reason against it?!
> 
> Thanks,
> 
> MARK

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: List loaded twice from DB

Posted by Mark <li...@mark-arnold.net>.
Hi Nick, thanks for this response.

The next question is probably to be decided by the Tapestry developers, 
but maybe somebody else has some insights on this or knows if this has 
been discussed before:

Would it not make more sense to be able to specify a "attach-value" and 
a "detach-value" instead of a "initial-value"?
This way I could explicitly specify two different values for the two 
points in time of the page's lifecycle. I could do:

<property name="myList" attach-value="ognl:service.loadListFromDb()" 
detach-value="ognl:null"/>

The reason being that it doesn't seem to make much sense to perform 
resource-expensive operations like DB queries for cleanup AFTER the page 
is used. As far as I understand, this post-use initialization is mainly 
done to prevent data that belongs to one user from being "accidentally" 
carried over to the next user.
So setting the property to null when the page is returned to the pool 
should be enough for that purpose. Especially since by the time the next 
user gets the page from the pool, the cached value might long be outdated.

On the other hand, this idea sounds too simple for it to never have come 
up before, so maybe there is a good reason against it?!

Thanks,

MARK



Nick Westgate wrote:
> Hi Mark.
>
> The "initial-value" attribute is poorly named.
>
> What it does is initialize your page property when the page
> is being *returned* to the pool, so that a page pulled from
> the pool has this "initial" property value.
>
> Of course, to facilitate the above, when a page is first
> constructed it must be initialized. That's why you're seeing
> two invocations: on construction and on return to the pool.
>
> I suggest you carefully read this entire section:
> http://jakarta.apache.org/tapestry/UsersGuide/state.html#state.page-properties 
>
>
> And the FAQ "Where do I "initialize" values for a page?":
> http://wiki.apache.org/tapestry/MoreFrequentlyAskedQuestions
>
> I'm still using T3, not 4, and I use the PageRenderListener approach:
>
>     public void pageBeginRender(PageEvent event)
>     {
>         // initialize properties etc
>         if (!event.getRequestCycle().isRewinding())
>         {
>             if (getXXX() == null)
>             {
>                 ...
>                 setXXX(...);
>             }
>         }
>     }
>
> Cheers,
> Nick.
>
>
> Mark wrote:
>> Hi Ron,
>>
>> it sounds like this would work, but isn't this just a workaround for 
>> something that really should not happen this way in the first place?
>>
>> Thanks,
>>
>> MARK
> ...
>>>>    <property 
>>>> name="roomList">ognl:administrationService.getAllRooms()</property>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: List loaded twice from DB

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Hi Mark.

The "initial-value" attribute is poorly named.

What it does is initialize your page property when the page
is being *returned* to the pool, so that a page pulled from
the pool has this "initial" property value.

Of course, to facilitate the above, when a page is first
constructed it must be initialized. That's why you're seeing
two invocations: on construction and on return to the pool.

I suggest you carefully read this entire section:
http://jakarta.apache.org/tapestry/UsersGuide/state.html#state.page-properties

And the FAQ "Where do I "initialize" values for a page?":
http://wiki.apache.org/tapestry/MoreFrequentlyAskedQuestions

I'm still using T3, not 4, and I use the PageRenderListener approach:

     public void pageBeginRender(PageEvent event)
     {
         // initialize properties etc
         if (!event.getRequestCycle().isRewinding())
         {
             if (getXXX() == null)
             {
                 ...
                 setXXX(...);
             }
         }
     }

Cheers,
Nick.


Mark wrote:
> Hi Ron,
> 
> it sounds like this would work, but isn't this just a workaround for 
> something that really should not happen this way in the first place?
> 
> Thanks,
> 
> MARK
...
>>>    <property 
>>> name="roomList">ognl:administrationService.getAllRooms()</property>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: List loaded twice from DB

Posted by Mark <li...@mark-arnold.net>.
Hi Ron,

it sounds like this would work, but isn't this just a workaround for 
something that really should not happen this way in the first place?

Thanks,

MARK

Ron Piterman wrote:
> just an idea: try to implement the 'roomlist' property yourself, as I 
> described in my previous postings, instead of letting tapestry do it.
> may be this will help.
> don't forget to implement a pageDetachListener which sets the property 
> to null.
> I always had good experience when doing it like this.
> Cheers,
> Ron
>
>
> Mark wrote:
>> Hi Ron,
>>
>> I don't understand what you mean by "instead of doing it on 
>> finishLoad()". I did not do anything with finishLoad(), I don't know 
>> why it calls the getList.
>>
>> Here is my .page file:
>>
>>
>> <page-specification 
>> class="com.mark_arnold.sample.rbs1.web.tapestry.page.admin.RoomListPage"> 
>>
>>    <inject property="administrationService" 
>> object="spring:rbsRoomAdminService" />
>>    <inject property="pageService" object="engine-service:page"/>
>>
>>    <inject property="messageResource" 
>> object="spring:applicationContext"/>
>>
>>    <property 
>> name="roomList">ognl:administrationService.getAllRooms()</property>
>>    <property name="debug">true</property>
>>    <property name="room"/>
>>    <property name="editPageName" 
>> initial-value="literal:admin/RoomAdminPage"/>
>> </page-specification>
>>
>> My Page class extends BasePage, but only overwrites pageAttached() 
>> (nothing related to the list in here).
>>
>> MARK
>>
>>
>> Ron Piterman wrote:
>>> use lazy initialization for the list instead of doing it on 
>>> finishLoad() :
>>>
>>> public List getXXXList() {
>>>   if (this.xxxList == null )
>>>     this.xxxList = readXXXList();
>>>   return this.xxxList;
>>> }
>>>
>>> +
>>>
>>> pageDetachListener -> this.xxxList = null.
>>>
>>> Cheers,
>>> Ron
>>>
>>>
>>> Mark wrote:
>>>> Hi,
>>>>
>>>> I have a simple CRUD scenario with a "ListPage" and a "ModifyPage".
>>>> The ListPage gets all records from the DB by calling the method 
>>>> "getAllRooms()" of a "RoomAdminService" and lists them in a table.
>>>> For some reason the query "select * from rooms" is executed twice 
>>>> every time the page is accessed.
>>>>
>>>> getAllRooms() is only referenced once in the .page file to plug a 
>>>> page property, the .html file then references that property
>>>>
>>>> I compared the StackTraces of the two calls, they have identical 
>>>> tops and bottoms, but differ somwhere in the middle:
>>>>
>>>>        at $RoomListPage_3.finishLoad($RoomListPage_3.java)
>>>>        at 
>>>> org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:439) 
>>>>
>>>>        at 
>>>> org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:613)
>>>>        at 
>>>> $IPageLoader_10b79e6e7bf.loadPage($IPageLoader_10b79e6e7bf.java)
>>>>        at 
>>>> $IPageLoader_10b79e6e7c0.loadPage($IPageLoader_10b79e6e7c0.java)
>>>>        at 
>>>> org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:120)
>>>>        at 
>>>> $IPageSource_10b79e6e724.getPage($IPageSource_10b79e6e724.java)
>>>>        at 
>>>> org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:268) 
>>>>
>>>>        at 
>>>> org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:251)
>>>>        at 
>>>> org.apache.tapestry.engine.RequestCycle.activate(RequestCycle.java:609) 
>>>>
>>>>        at 
>>>> org.apache.tapestry.engine.PageService.service(PageService.java:66)
>>>>        at 
>>>> $IEngineService_10b79e6e7af.service($IEngineService_10b79e6e7af.java)
>>>>        at 
>>>> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66) 
>>>>
>>>>
>>>>
>>>> and
>>>>
>>>>        at $RoomListPage_3.pageDetached($RoomListPage_3.java)
>>>>        at 
>>>> org.apache.tapestry.AbstractPage.firePageDetached(AbstractPage.java:452) 
>>>>
>>>>        at 
>>>> org.apache.tapestry.AbstractPage.detach(AbstractPage.java:140)
>>>>        at 
>>>> org.apache.tapestry.pageload.PageSource.releasePage(PageSource.java:147) 
>>>>
>>>>        at 
>>>> $IPageSource_10b79e6e724.releasePage($IPageSource_10b79e6e724.java)
>>>>        at 
>>>> org.apache.tapestry.engine.RequestCycle.cleanup(RequestCycle.java:192)
>>>>
>>>>
>>>> So it seems like the first call comes out of the finishLoad(), 
>>>> while the second call is caused by pageDetached() of my ListPage.
>>>>
>>>>
>>>> Does anybody know why it would access the getAllRooms() twice?
>>>>
>>>> Thanks,
>>>>
>>>> MARK


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: List loaded twice from DB

Posted by Ron Piterman <rp...@gmx.net>.
just an idea: try to implement the 'roomlist' property yourself, as I 
described in my previous postings, instead of letting tapestry do it.
may be this will help.
don't forget to implement a pageDetachListener which sets the property 
to null.
I always had good experience when doing it like this.
Cheers,
Ron


Mark wrote:
> Hi Ron,
> 
> I don't understand what you mean by "instead of doing it on 
> finishLoad()". I did not do anything with finishLoad(), I don't know why 
> it calls the getList.
> 
> Here is my .page file:
> 
> 
> <page-specification 
> class="com.mark_arnold.sample.rbs1.web.tapestry.page.admin.RoomListPage">
>    <inject property="administrationService" 
> object="spring:rbsRoomAdminService" />
>    <inject property="pageService" object="engine-service:page"/>
> 
>    <inject property="messageResource" object="spring:applicationContext"/>
> 
>    <property 
> name="roomList">ognl:administrationService.getAllRooms()</property>
>    <property name="debug">true</property>
>    <property name="room"/>
>    <property name="editPageName" 
> initial-value="literal:admin/RoomAdminPage"/>
> </page-specification>
> 
> My Page class extends BasePage, but only overwrites pageAttached() 
> (nothing related to the list in here).
> 
> MARK
> 
> 
> Ron Piterman wrote:
>> use lazy initialization for the list instead of doing it on 
>> finishLoad() :
>>
>> public List getXXXList() {
>>   if (this.xxxList == null )
>>     this.xxxList = readXXXList();
>>   return this.xxxList;
>> }
>>
>> +
>>
>> pageDetachListener -> this.xxxList = null.
>>
>> Cheers,
>> Ron
>>
>>
>> Mark wrote:
>>> Hi,
>>>
>>> I have a simple CRUD scenario with a "ListPage" and a "ModifyPage".
>>> The ListPage gets all records from the DB by calling the method 
>>> "getAllRooms()" of a "RoomAdminService" and lists them in a table.
>>> For some reason the query "select * from rooms" is executed twice 
>>> every time the page is accessed.
>>>
>>> getAllRooms() is only referenced once in the .page file to plug a 
>>> page property, the .html file then references that property
>>>
>>> I compared the StackTraces of the two calls, they have identical tops 
>>> and bottoms, but differ somwhere in the middle:
>>>
>>>        at $RoomListPage_3.finishLoad($RoomListPage_3.java)
>>>        at 
>>> org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:439) 
>>>
>>>        at 
>>> org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:613)
>>>        at 
>>> $IPageLoader_10b79e6e7bf.loadPage($IPageLoader_10b79e6e7bf.java)
>>>        at 
>>> $IPageLoader_10b79e6e7c0.loadPage($IPageLoader_10b79e6e7c0.java)
>>>        at 
>>> org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:120)
>>>        at 
>>> $IPageSource_10b79e6e724.getPage($IPageSource_10b79e6e724.java)
>>>        at 
>>> org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:268)
>>>        at 
>>> org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:251)
>>>        at 
>>> org.apache.tapestry.engine.RequestCycle.activate(RequestCycle.java:609)
>>>        at 
>>> org.apache.tapestry.engine.PageService.service(PageService.java:66)
>>>        at 
>>> $IEngineService_10b79e6e7af.service($IEngineService_10b79e6e7af.java)
>>>        at 
>>> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66) 
>>>
>>>
>>>
>>> and
>>>
>>>        at $RoomListPage_3.pageDetached($RoomListPage_3.java)
>>>        at 
>>> org.apache.tapestry.AbstractPage.firePageDetached(AbstractPage.java:452)
>>>        at org.apache.tapestry.AbstractPage.detach(AbstractPage.java:140)
>>>        at 
>>> org.apache.tapestry.pageload.PageSource.releasePage(PageSource.java:147)
>>>        at 
>>> $IPageSource_10b79e6e724.releasePage($IPageSource_10b79e6e724.java)
>>>        at 
>>> org.apache.tapestry.engine.RequestCycle.cleanup(RequestCycle.java:192)
>>>
>>>
>>> So it seems like the first call comes out of the finishLoad(), while 
>>> the second call is caused by pageDetached() of my ListPage.
>>>
>>>
>>> Does anybody know why it would access the getAllRooms() twice?
>>>
>>> Thanks,
>>>
>>> MARK
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: List loaded twice from DB

Posted by Mark <li...@mark-arnold.net>.
Hi Ron,

I don't understand what you mean by "instead of doing it on 
finishLoad()". I did not do anything with finishLoad(), I don't know why 
it calls the getList.

Here is my .page file:


<page-specification 
class="com.mark_arnold.sample.rbs1.web.tapestry.page.admin.RoomListPage">
    <inject property="administrationService" 
object="spring:rbsRoomAdminService" />
    <inject property="pageService" object="engine-service:page"/>

    <inject property="messageResource" object="spring:applicationContext"/>

    <property 
name="roomList">ognl:administrationService.getAllRooms()</property>
    <property name="debug">true</property>
    <property name="room"/>
    <property name="editPageName" 
initial-value="literal:admin/RoomAdminPage"/>
</page-specification>

My Page class extends BasePage, but only overwrites pageAttached() 
(nothing related to the list in here).

MARK


Ron Piterman wrote:
> use lazy initialization for the list instead of doing it on 
> finishLoad() :
>
> public List getXXXList() {
>   if (this.xxxList == null )
>     this.xxxList = readXXXList();
>   return this.xxxList;
> }
>
> +
>
> pageDetachListener -> this.xxxList = null.
>
> Cheers,
> Ron
>
>
> Mark wrote:
>> Hi,
>>
>> I have a simple CRUD scenario with a "ListPage" and a "ModifyPage".
>> The ListPage gets all records from the DB by calling the method 
>> "getAllRooms()" of a "RoomAdminService" and lists them in a table.
>> For some reason the query "select * from rooms" is executed twice 
>> every time the page is accessed.
>>
>> getAllRooms() is only referenced once in the .page file to plug a 
>> page property, the .html file then references that property
>>
>> I compared the StackTraces of the two calls, they have identical tops 
>> and bottoms, but differ somwhere in the middle:
>>
>>        at $RoomListPage_3.finishLoad($RoomListPage_3.java)
>>        at 
>> org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:439) 
>>
>>        at 
>> org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:613)
>>        at 
>> $IPageLoader_10b79e6e7bf.loadPage($IPageLoader_10b79e6e7bf.java)
>>        at 
>> $IPageLoader_10b79e6e7c0.loadPage($IPageLoader_10b79e6e7c0.java)
>>        at 
>> org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:120)
>>        at 
>> $IPageSource_10b79e6e724.getPage($IPageSource_10b79e6e724.java)
>>        at 
>> org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:268)
>>        at 
>> org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:251)
>>        at 
>> org.apache.tapestry.engine.RequestCycle.activate(RequestCycle.java:609)
>>        at 
>> org.apache.tapestry.engine.PageService.service(PageService.java:66)
>>        at 
>> $IEngineService_10b79e6e7af.service($IEngineService_10b79e6e7af.java)
>>        at 
>> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66) 
>>
>>
>>
>> and
>>
>>        at $RoomListPage_3.pageDetached($RoomListPage_3.java)
>>        at 
>> org.apache.tapestry.AbstractPage.firePageDetached(AbstractPage.java:452)
>>        at org.apache.tapestry.AbstractPage.detach(AbstractPage.java:140)
>>        at 
>> org.apache.tapestry.pageload.PageSource.releasePage(PageSource.java:147)
>>        at 
>> $IPageSource_10b79e6e724.releasePage($IPageSource_10b79e6e724.java)
>>        at 
>> org.apache.tapestry.engine.RequestCycle.cleanup(RequestCycle.java:192)
>>
>>
>> So it seems like the first call comes out of the finishLoad(), while 
>> the second call is caused by pageDetached() of my ListPage.
>>
>>
>> Does anybody know why it would access the getAllRooms() twice?
>>
>> Thanks,
>>
>> MARK
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: List loaded twice from DB

Posted by Ron Piterman <rp...@gmx.net>.
use lazy initialization for the list instead of doing it on finishLoad() :

public List getXXXList() {
   if (this.xxxList == null )
	this.xxxList = readXXXList();
   return this.xxxList;
}

+

pageDetachListener -> this.xxxList = null.

Cheers,
Ron


Mark wrote:
> Hi,
> 
> I have a simple CRUD scenario with a "ListPage" and a "ModifyPage".
> The ListPage gets all records from the DB by calling the method 
> "getAllRooms()" of a "RoomAdminService" and lists them in a table.
> For some reason the query "select * from rooms" is executed twice every 
> time the page is accessed.
> 
> getAllRooms() is only referenced once in the .page file to plug a page 
> property, the .html file then references that property
> 
> I compared the StackTraces of the two calls, they have identical tops 
> and bottoms, but differ somwhere in the middle:
> 
>        at $RoomListPage_3.finishLoad($RoomListPage_3.java)
>        at 
> org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:439) 
> 
>        at 
> org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:613)
>        at $IPageLoader_10b79e6e7bf.loadPage($IPageLoader_10b79e6e7bf.java)
>        at $IPageLoader_10b79e6e7c0.loadPage($IPageLoader_10b79e6e7c0.java)
>        at 
> org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:120)
>        at $IPageSource_10b79e6e724.getPage($IPageSource_10b79e6e724.java)
>        at 
> org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:268)
>        at 
> org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:251)
>        at 
> org.apache.tapestry.engine.RequestCycle.activate(RequestCycle.java:609)
>        at 
> org.apache.tapestry.engine.PageService.service(PageService.java:66)
>        at 
> $IEngineService_10b79e6e7af.service($IEngineService_10b79e6e7af.java)
>        at 
> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66) 
> 
> 
> 
> and
> 
>        at $RoomListPage_3.pageDetached($RoomListPage_3.java)
>        at 
> org.apache.tapestry.AbstractPage.firePageDetached(AbstractPage.java:452)
>        at org.apache.tapestry.AbstractPage.detach(AbstractPage.java:140)
>        at 
> org.apache.tapestry.pageload.PageSource.releasePage(PageSource.java:147)
>        at 
> $IPageSource_10b79e6e724.releasePage($IPageSource_10b79e6e724.java)
>        at 
> org.apache.tapestry.engine.RequestCycle.cleanup(RequestCycle.java:192)
> 
> 
> So it seems like the first call comes out of the finishLoad(), while the 
> second call is caused by pageDetached() of my ListPage.
> 
> 
> Does anybody know why it would access the getAllRooms() twice?
> 
> Thanks,
> 
> MARK
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org