Hello!

I can see same problems I have met almost a year before.
Also have module architecture...

First of all don't use  Configuration.initializeSharedConfiguration(
fileConf  );
It's not for module applications...

You could use something like this:

Configuration conf = new DefaultConfiguration("module1-cayenne.xml");
conf.initialize();              //mandatory. Means "load and parse my xml".
DataDomain module1Domain = conf.getDomain();  //actually it's a
factory for DataContext based on configuration
DataContext module1Ctx = module1Domain.createDataContext();  //here we
go! we got context for module1



Evgeny.



2010/6/21 mr.abanjo <[email protected]>:
> Hi,
> i'm working with a lot' of web sites. Most of them must connect to the some
> databases to read / write data.
> So, for every kind of "content", i've created a library (jar) that manages
> the database's operations.
> For example,  user, news, meteo ecc.. are managed in different libraries
> included in different war (one for each webapp).
> In this way, i have a single code to mantain, and if i must fix some error i
> can change the code in a single place, and all webapps get the fix when i
> recreate the war.
> Now, the problem is that i want to let the library to be indipendent from
> the webapps that use it. In the jar i put the cayenne.xml and the
> corresponding datamap, but if a webapp need to load different kind of data
> (es meteo, and news) in the war i have more than one "cayenne.xml" file.(es
> meteo_cayenne.xml, news_cayenne.xml).
> I can use different names for them but what's happen when i call:
>
>  Configuration.initializeSharedConfiguration(  fileConf  );
>
> for each file?
> Is this the right way?
>
> Also i can leave the datamap in the library, and the cayenne.xml file in the
> webapp, using different "domains" declared in it. But in this way, the
> library is not completly indipendent. What i want to obtain is that the
> webapp don't know nothing about a database/cayenne (except declaring the
> jndi connection).
> There is a way to reach this objective?
>
> Thanks,
> Davide
>

Reply via email to