You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Luke Galea <lg...@bluecatnetworks.com> on 2003/02/11 16:09:26 UTC
Strange problem with cycle attributes
Hello,
I am trying to associate an object with a single request.. and I am
doing so by setting an attribute in the request cycle.
I am experiencing some strangeness.. namely that it doesn't seem to be
storing my setting.
Below is my code.. And as far as I can tell, it should never say "No
Session Found" more than once for a given request... but it is doing so
for each call... Is there something I am doing wrong?
public synchronized Session getSession() throws SQLException
{
Object session = getRequestCycle().getAttribute(
REQUEST_ATTRIBUTE );
if( session == null )
{
log.debug( "No Session Found! Creating New!!" );
session = Persistor.getSessionFactory().openSession();
assert session != null;
getRequestCycle().setAttribute( REQUEST_ATTRIBUTE, session
);
}
return (Session) session;
}
Thanks in advance.
Luke Galea
Software Development
BlueCat <http://www.bluecatnetworks.com/> Networks
905-762-5225