Re: Best practices question

From: Eric BIANCHI (eric.bianch..odanotech.ch)
Date: Thu Oct 04 2007 - 11:24:49 EDT

  • Next message: Andrus Adamchik: "Re: Best practices question"

    Hello Chris,

    We have the same configuration here.

    We put cayenne.xml in our/class/path/ in Package B.

     From Package A, we load package B's cayenne.xml :

    DefaultConfiguration conf = new DefaultConfiguration();
    conf.addClassPath("our/class/path");
    Configuration.initializeSharedConfiguration(conf);

    Then we load package A's cayenne.xml

    DefaultConfiguration conf2 = new DefaultConfiguration();

    And finally we merge the two datamaps :

    try {
            conf2.initialize();
            Configuration.getSharedConfiguration().getDomain().addMap((DataMap)
    conf2.getDomain().getDataMaps().iterator().next());
            Configuration.getSharedConfiguration().getDomain().addNode
    ((DataNode) conf2.getDomain().getDataNodes().iterator().next());
    } catch (Exception e) {
            //beuh...
    }
            
    I hope it helps !!

    Best Regards

    Eric

    Le 4 oct. 07 à 16:16, Chris Gamache a écrit :

    > Here's the scenario...
    >
    > Project A uses cayenne
    > Project B also uses cayenne
    >
    > They both have a cayenne.xml and nodes and domains, etc.
    >
    > Package A uses package B. I'm finding that when package A first
    > initializes cayenne, subsequent initializations when classes from
    > package B are instantiated ignore the cayenne.xml file from package B
    > and it's underlying maps,nodes,domains, etc. causing some chaos. I bet
    > this is the expected behavior. I could merge and copy the cayenne.xml
    > files so that all packages use the same file. I bet there's a better
    > way, though. Perhaps even the /best/ (tm) way...
    >
    > Please advise!
    >
    > CG
    >

    --
    Eric BIANCHI
    ---------------------------------------
    eric.bianch..odanotech.ch         +41 (0)774 10 80 36
    http://www.rodanotech.ch           Skype: erbianchi
    



    This archive was generated by hypermail 2.0.0 : Thu Oct 04 2007 - 11:25:48 EDT