Re: Loading multiple cayenne.xml

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Mar 06 2007 - 11:50:24 EST

  • Next message: Peter Schröder: "AW: out of memory"

    We wanted to support this in Cayenne, just never got around actually
    doing it... You are on the right track, but to be able to use a
    single DataContext that has access to nodes and DataMaps of all
    cayenne.xml instances, you'll need to develop an algorithm to merge
    all configuration instances in one:

    Step 1: load the first cayenne.xml into a Configuration instance -
    this will be the "master config".
    Step 2: load the next cayenne.xml in a separate Configuration, and
    take all its DataDomains, and place them in the master config. If you
    have DataDomains with matching names, you'd have to merge the DataMap
    and DataNode objects into the existing Domains, and so on.
    Step 3: repeat step 2 for all remaining cayenne.xml.

    In other words this is a tree merge algorithm that applies to the
    following trees:

    Configuration
       DataDomain 1..N
            DataNode 1..N
            DataMap 1..N

    Andrus

    On Mar 6, 2007, at 5:19 PM, Eric BIANCHI wrote:

    > Hi list,
    >
    > I'd like to load mutliple cayenne.xml and use them in my project.
    >
    > I've managed to load them in mutliple datacontext by using the
    > following code :
    >
    > DefaultConfiguration conf = new DefaultConfiguration();
    > conf.addClassPath("my/class/path");
    > Configuration.initializeSharedConfiguration(conf);
    > DataContext contextMyDomain = DataContext.createDataContext
    > ("myDomain");
    >
    > ... repeat this until last cayenne.xml
    >
    > I'd like to use only one DataContext, so I guess I have to take all
    > nodes and register them in the first DataContext (doesn't work so far)
    >
    > I'm not sure I'm doing things "the cayenne way".
    >
    > Have someone done it before ? Could you point me to the right
    > documentation ?
    >
    > Thanks in advance, best regards
    >
    > --
    > Eric BIANCHI
    >
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Mar 06 2007 - 11:51:34 EST