Re: Best Way to get a DataContext (in this case)

From: Michael Gentry (blacknex..mail.com)
Date: Sat Jan 20 2007 - 10:16:51 EST

  • Next message: Michael Gentry: "Re: help on relationship"

    When your timer goes off and you collect your statistics, do you need
    to share those statistics (the actual DataContext) elsewhere? If not,
    you could just create a new local DataContext in your timer handler
    methods.

    /dev/mrg

    On 1/19/07, Gary Jarrel <garyjarre..mail.com> wrote:
    > Hi All!
    >
    > I've got a web app using struts, spring and cayenne. I use a web
    > application listener to setup the thread bound data context for any
    > given actions. All database access is abstracted away via a number of
    > DAOs. For any given action (all managed by spring) the required DAOs
    > are injected and are able to access the data context as it has been
    > bound to the thread. All works very well.
    >
    > Now we've created a number of objects which collect various stats on
    > the data in the DB. These are executed at various time intervals and
    > are managed by Spring and the Quartz API. My question is what is the
    > best practice in providing a data context for these types of objects.
    > Can't use a listener as no Action is being executed - Spring simply
    > instantiates the object and executes the specified method. Should I
    > perhaps go the way described in the Cayenne/Spring example? Seems as
    > though there is a fair bit of implementation for just a few objects.
    >
    > Any suggestions would be much appreciated!
    >
    > Thank you!
    >
    > - garyj
    >



    This archive was generated by hypermail 2.0.0 : Sat Jan 20 2007 - 10:17:24 EST