Cayenne DataContext plus Axis session

From: JR Ruggentaler (JR.Ruggentale..pv.com)
Date: Thu Feb 03 2005 - 15:59:27 EST

  • Next message: Pirola Davide: "Cache with StoredProcedure cursor parameter"

    I am working on session based Axis WebServices. I presume each Axis session is a separate thread or thread pool instance. I copied the Cayenne Web application binding code (BasicServletConfiguration.getDefaultContext(...)) and modified it as follows to access a Axis session bound DataContext.

    public class CayenneUtil {

      /**
       * Returns default Cayenne DataContext associated with the Axis Session.
       * If no DataContext exists in the session, it is created on the spot.
       */
      public static DataContext getDefaultContext(Session session) {
        synchronized (session) {
          DataContext ctxt =
            (DataContext) session.get(BasicServletConfiguration.DATA_CONTEXT_KEY);

          if (ctxt == null) {
            ctxt = DataContext.createDataContext();
            session.set(BasicServletConfiguration.DATA_CONTEXT_KEY, ctxt);
          }

          return ctxt;
        }
      }
    }

    Is this the proper way to get a DataContext in Axis? Do I need to change any configuration settings (like web.xml)?

    Thanks in advance!
    J.R.



    This archive was generated by hypermail 2.0.0 : Thu Feb 03 2005 - 15:59:30 EST