Re: Old web application needs a second database

From: Borut Bolčina (borut.bolcin..mail.com)
Date: Mon May 03 2010 - 08:52:51 EDT

  • Next message: Borut Bolčina: "Re: Old web application needs a second database"

    Thanks,

    So, my-cayenne.xml can only include node B and not both nodes as this new
    functionality only needs access to database B.

    Is that correct?

    -Borut

    2010/5/3 Andrus Adamchik <andru..bjectstyle.org>

    >
    > On May 3, 2010, at 3:12 PM, Borut Bolčina wrote:
    >
    > There will be cayenne.xml (with node A) and
    >> my-cayenne.xml (with node A and B) on the classpath. Is that why?
    >>
    >
    > Yes.
    >
    >
    > I am not sure how to initialize.
    >>
    >
    > #1 is created implicitly when you call DataContext.createDataContext().
    > That's the one returned from Configuration.getSharedConfiguration().
    >
    > #2 you will have to create yourself and store somewhere. E.g. in a
    > ServletContext attribute.
    >
    >
    > DefaultConfiguration conf = new DefaultConfiguration("my-cayenne.xml");
    > // store it for the app duration soemwhere
    > ...
    >
    > // later when you need a new context:
    > Configuration conf = .. // get it from ServletContext or from where you put
    > it
    > return conf.getDomain().createDataContext();
    >
    > Andrus



    This archive was generated by hypermail 2.0.0 : Mon May 03 2010 - 08:53:41 EDT