net.databinder.hib.conv
Class DataConversationRequestCycle

java.lang.Object
  extended by org.apache.wicket.RequestCycle
      extended by org.apache.wicket.protocol.http.WebRequestCycle
          extended by net.databinder.ExceptionFilteringRequestCycle
              extended by net.databinder.CookieRequestCycle
                  extended by net.databinder.hib.DataRequestCycle
                      extended by net.databinder.hib.conv.DataConversationRequestCycle
All Implemented Interfaces:
HibernateRequestCycle

public class DataConversationRequestCycle
extends DataRequestCycle

Supports extended Hibernate sessions for long conversations. This is useful for a page or a series of pages where changes are made to an entity that can not be immediately committed. Using a "conversation" session, HibernateObjectModels are used normally, but until the session is flushed the changes are not made to persistent storage.

Author:
Nathan Hamblen

Field Summary
 
Fields inherited from class net.databinder.hib.DataRequestCycle
keys
 
Fields inherited from class org.apache.wicket.RequestCycle
application, processor, request, response
 
Constructor Summary
DataConversationRequestCycle(org.apache.wicket.protocol.http.WebApplication application, org.apache.wicket.protocol.http.WebRequest request, org.apache.wicket.Response response)
           
 
Method Summary
 void dataSessionRequested(java.lang.Object key)
          Called by DataStaticService when a session is needed and does not already exist.
protected  void onBeginRequest()
          Does nothing; The session is open or retreived only when the request target is known.
protected  void onEndRequest()
          Inspects responding page to determine if current Hibernate session should be closed or left open and stored in the page.
 org.apache.wicket.Page onRuntimeException(org.apache.wicket.Page page, java.lang.RuntimeException e)
          Closes and reopens Hibernate session for this Web session.
 
Methods inherited from class net.databinder.hib.DataRequestCycle
closeSession, openHibernateSession
 
Methods inherited from class net.databinder.CookieRequestCycle
applyScope, clearCookie, getCookie, getCookies
 
Methods inherited from class net.databinder.ExceptionFilteringRequestCycle
logRuntimeException, setWarnOnlySource
 
Methods inherited from class org.apache.wicket.protocol.http.WebRequestCycle
getProcessor, getWebRequest, getWebResponse, getWebSession, isRedirect, newClientInfo, redirectTo
 
Methods inherited from class org.apache.wicket.RequestCycle
detach, get, getApplication, getClientInfo, getMetaData, getOriginalResponse, getPageParameters, getRedirect, getRequest, getRequestTarget, getResponse, getResponsePage, getResponsePageClass, getSession, getStartTime, isUrlForNewWindowEncoding, request, request, request, set, setAutomaticallyClearFeedbackMessages, setMetaData, setRedirect, setRequest, setRequestTarget, setResponse, setResponsePage, setResponsePage, setResponsePage, setResponsePage, setUrlForNewWindowEncoding, toString, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, wasHandled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataConversationRequestCycle

public DataConversationRequestCycle(org.apache.wicket.protocol.http.WebApplication application,
                                    org.apache.wicket.protocol.http.WebRequest request,
                                    org.apache.wicket.Response response)
Method Detail

onBeginRequest

protected void onBeginRequest()
Does nothing; The session is open or retreived only when the request target is known.

Overrides:
onBeginRequest in class org.apache.wicket.RequestCycle

dataSessionRequested

public void dataSessionRequested(java.lang.Object key)
Called by DataStaticService when a session is needed and does not already exist. Determines current page and retrieves its associated conversation session if appropriate. Does nothing if current page is not yet available.

Specified by:
dataSessionRequested in interface HibernateRequestCycle
Overrides:
dataSessionRequested in class DataRequestCycle
Parameters:
key - factory key object, or null for the default factory

onEndRequest

protected void onEndRequest()
Inspects responding page to determine if current Hibernate session should be closed or left open and stored in the page.

Overrides:
onEndRequest in class DataRequestCycle
See Also:
DataForm.onSubmit()

onRuntimeException

public org.apache.wicket.Page onRuntimeException(org.apache.wicket.Page page,
                                                 java.lang.RuntimeException e)
Closes and reopens Hibernate session for this Web session. Unrelated models may try to load themselves after this point.

Overrides:
onRuntimeException in class DataRequestCycle


Copyright © 2005-2008 Nathan Hamblen. All Rights Reserved.