Hi,

I notice that afterPhase method in the PhaseListener included in this email is exceuted before the Rendering is completed(Is that correct behaviour). During rendering the JSF view the datamodel is accessed which in turn accesses the database. In order to access the database a new DB session is created, thus defeating the purpose of having a DBUtil.closeSession()
in the afterPhase method.

Is this correct behaviour? Is it likely that something is wrong with my configuration?

There is a dataTable component in the JSF page. The getRowCount() method goes
to the database to get the latest count of rows.

The snippet from JSF page is:

...
<h:dataTable id="channelData" value="#{findChannelBean.channelModel}" var="rowVar" first="0" rows="10" border="0" headerClass="findChannel_headerClass" columnClasses="findChannel_name, findChannel_description" width="600px" rendered="#{findChannelBean.showChannelDataTable}">
...

When my JSF page does not contain a dataTable session opening and closing of the db session work as expected.
Let me know if you need more info.

-Umesh
(Phase Listener Code attached below)

-----------------------------------x-------------------------

package com.ebay.channel.phaselisteners;

import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;

import com.ebay.db.DbUtil;

public class SessionClosePhaseListener implements PhaseListener {

       public void beforePhase(PhaseEvent event) {

       }

       public void afterPhase(PhaseEvent event) {

               DbUtil.closeSession();
       }

       public PhaseId getPhaseId() {

               return PhaseId.RENDER_RESPONSE;
       }

}


Reply via email to