Re: Cayenne, Tapestry and DataContext

From: Borut Bolčin (cayenn..mail.si)
Date: Sat Nov 05 2005 - 15:14:16 EST

  • Next message: Oscar Picasso: "Re: Cayenne, Tapestry and DataContext"

    Hi Oscar,

    I am also learning Cayenne and Tapestry 4 at the moment. The application
    I am currently on has one DataContext in my ASO application scope class.

        private DataContext context;
        context = DataContext.getThreadDataContext();

    I use this one to check if the user already exists in the database. When
    session ASO is created (by setting some of its set method) a per user
    DataContext is created in the constructor of the session object (which I
    call Session instead of Visit). From there on I use

        DataContext dc = getSession().getDataContext();

    with this defined earlier

       ..njectState("session")
        abstract public Session getSession();

    I am not sure how getThreadDataContext() works. When exactly does this
    method call return different/same data context? Maybe someone more
    experienced will help.

    I am not sure what you mean by DataContext growth by retrieving from it.
    I guess growth can be controlled.

    -Borut

    Oscar Picasso wrote:

    >Hi,
    >
    >I have a Tapestry application with some parts that are stateless and other
    >stateful.
    >
    >For the stateful part I understand that I need to store a DataContext for each
    >user in its visit object.
    >
    >But what about the stateless part (no visit object).
    >
    >Is it better to provide one new DataContext for each request or store one, for
    >example, in the Global object an reuse it?
    >
    >Another somewhat related question.
    >
    >I have a big potential graph.
    >
    >From one object of the graph I can retrieve other objects.
    >
    >Does the related DataContext grows each time I retrieve an object from the
    >graph with a potential OutOfMemoryException? If that's the case, what is the
    >best strategy to avoid this?
    >
    >
    >Thanks
    >
    >Oscar
    >
    >__________________________________________________
    >Do You Yahoo!?
    >Tired of spam? Yahoo! Mail has the best spam protection around
    >http://mail.yahoo.com
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Nov 05 2005 - 15:13:50 EST