Been meaning to implement a runtime "multiple configs merge"
algorithm in Cayenne for some time. I think there may even be a Jira
for that somewhere. Conceptually this is a valuable addition as it
allows seamless modular packaging.
As for the workaround that does not involve manual merging, I usually
create a separate mapping project with a single cayenne.xml that can
be imported in multiple applications. Inside that project I separate
logical "packages" by placing them in separate DataMaps.
Andrus
On Oct 4, 2007, at 6:24 PM, Eric BIANCHI wrote:
> 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 - 12:33:44 EDT