seam and webservice

来源:互联网 发布:单片机基础 编辑:程序博客网 时间:2024/06/03 22:15
 I have a working solution ....

in my ContextualHttpRequest, I call the same code as in SeamPhaseListener for JSF.

before proceeding the request :

Quote:


void begin()
{
try
{
if ( !Transaction.instance().isActiveOrMarkedRollback() )
{
//log.debug("beginning transaction prior to phase: " + phaseId);
Transaction.instance().begin();
}
}
catch (Exception e)
{
throw new IllegalStateException("Could not start transaction", e);
}
}

 

 

 

 





at the end :

Quote:
void commitOrRollback()
{
try
{
if ( Transaction.instance().isActive() )
{
//log.debug("committing transaction after phase: " + phaseId);
Transaction.instance().commit();
}
else if ( Transaction.instance().isRolledBackOrMarkedRollback() )
{
//log.debug("rolling back transaction after phase: " + phaseId);
Transaction.instance().rollback();
}
}
catch (Exception e)
{
throw new IllegalStateException("Could not commit transaction", e);
}
}



I'm sure there are issue with this solution but it works for the begining ...

 

 

((BindingProvider)auctionService).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,
 true);