Re: Cayenne DataContext plus Axis session

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Feb 04 2005 - 21:19:47 EST

  • Next message: Dmitry Gritsenko: "Re: flattened relations intermediate table records not deleted with cascade"

    Haven't used Axis much, but I guess this approach should work. Quick
    glance at the docs confirms that -
    http://ws.apache.org/axis/faq.html#faq9

    Andrus

    On Feb 3, 2005, at 3:59 PM, JR Ruggentaler wrote:

    > 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 : Fri Feb 04 2005 - 21:19:52 EST