[jboss-user] [JBoss Seam] - Re: Hibernate and regular JSF validation and EntityHome prob

hstang do-not-reply at jboss.com
Mon Jun 18 19:00:10 EDT 2007


"gavin.king at jboss.com" wrote : How many times does ManagedPersistenceContext.initEntityManager() get called?
  | 
  | How many times does Home.setInstance() get called?
  | 
  | Put breakpoints.

For both questions, once.

OK, I'm exhausted after trying to trace through at the end of the day...BUT here's my finding:  

I traced down to handleTransactionsAfterPhase() in SeamPhaseListener.java, line 312.  


  |    public void handleTransactionsAfterPhasel(PhaseEvent event)
  |    {
  |       if ( Init.instance().isTransactionManagementEnabled() ) 
  |       {
  |         log.info("handleTransactionsAfterPhase committing here**************");
  |          PhaseId phaseId = event.getPhaseId();
  |          boolean commitTran = phaseId==PhaseId.INVOKE_APPLICATION || 
  |                event.getFacesContext().getRenderResponse() || //TODO: no need to commit the tx if we failed to restore the view
  |                event.getFacesContext().getResponseComplete() ||
  |                ( phaseId==PhaseId.RENDER_RESPONSE && !Init.instance().isClientSideConversations() );
  |          
  |          if (commitTran)
  |          { 
  |             commitOrRollback(phaseId); //we commit before destroying contexts, cos the contexts have the PC in them
  |          }
  |       }
  |    }
  | 

This code suggests to commit/rollback transaction if validation fails, since you are checking if event.getFacesContext().getRenderResponse().  This is the same check you use in org.jboss.seam.core.Validation in afterProcessValidations.  Correct me if I'm wrong.

Could this be why my managed property is set to false, and the em could not find the instance anymore?




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055425#4055425

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055425



More information about the jboss-user mailing list