Hi Dave,
----- Original Message -----
From: "David C. Hicks" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, June 11, 2003 4:09 PM
Subject: Re: Multiple Databases in one repository.xml?
> Hey Armin,
>
> Thanks for the response. Upon reading through what you've provided I
> realized that maybe I didn't ask the right question. Let me see if I
> can explain it a little better.
>
> We have a library that utilizes both PersistenceBroker and ODMG that
> abstracts a lot of the OJB functionality for our objects. We use this
> library in a couple of different applications. One of these
> applications is a security management component that I have now been
> charged with integrating into another application. We currently have
> two completely separate repository.xml definitions for the two
> applications. We would prefer to keep the two separate for
maintenance
> reasons. So, what I'm hoping is that there is some way that I can
make
> use of the two xml files with as little merging as possible.
Please have a look in MetadataManager. MM enables you to
load (e.g. parse from separate file) connection metadata and
persistent object metadata at runtime.
Keep your 'security management component' stuff in a separate
repository file.
On startup off your security stuff or whenever you need
the security metadata do
<pseudo code>
(1) MM = MetadataManager.getInstance()
(2) desRep = MM.readDescriptorRepository(repositoryPath or InputStream)
(3) conRep = MM.readConnectionRepository(repositoryPath or InputStream)
(4) MM.mergeConnectionRepository(conRep)
(5) MM.mergeDescriptorRepository(desRep)
</pseudo code>
(1) get MetadataManager instance
(2) parse the persistent metadata object stuff (the class-descriptor's)
(3) parse connection metadata (the jdbc-connection-descriptors)
(4) merge the parsed connection metadata information with the existing
one
(5) merge the parsed object metadata information with the existing one
Is this what you mean?
regards,
Armin
>
> Any thoughts?
>
> Dave
>
>
> Armin Waibel wrote:
>
> >Hi David,
> >
> >----- Original Message -----
> >From: "David C. Hicks" <[EMAIL PROTECTED]>
> >To: "OJB" <[EMAIL PROTECTED]>
> >Sent: Tuesday, June 10, 2003 8:54 PM
> >Subject: Multiple Databases in one repository.xml?
> >
> >
> >
> >>From reading through the OJB documentation on repository.xml, I get
> >>
> >>
> >the
> >
> >
> >>impression that it is possible to have connection pools to two
> >>
> >>
> >different
> >
> >
> >>data sources in the same application, however I don't see any way to
> >>
> >>
> >map
> >
> >
> >>which objects are persisted in which data source.
> >>
> >>
> >
> >Say you have defined two different jdbc-connection-descriptor
> >using different datasources with jcd-alias names 'db_1' and 'db_2'.
> >PBKey key1 = new PBKey("db_1", "user1", "passwd1");
> >PBKey key2 = new PBKey("db_2", "user2", "passwd2");
> >
> >PersistenceBroker broker_1 = PBF.createPersistenceBroker(key1);
> >PersistenceBroker broker_2 = PBF.createPersistenceBroker(key2);
> >
> >Or is the problem that you get an object of type XY and
> >you want automatic decide which datasource/broker is
> >to use?
> >If so you can use custom-attributes in class-descriptor
> >tag (of the persistent object metadata):
> ><attribute
> > attribute-name="datasource"
> > attribute-value="db_1"/>
> >
> >read with
> >classdescriptor.getAttribute("datasource")
> >
> >To get the ClassDescriptor of the given object
> >you can use MetadataManager.
> >
> >regards,
> >Armin
> >
> >
> >
> >>Has anyone ever tried
> >>this? I actually do have a need to do this as I have a component
that
> >>utilizes OJB for persistence that will be embedded in several
> >>applications. One of these applications also uses OJB for
> >>
> >>
> >persistence,
> >
> >
> >>but all applications need to share a common database for my
component.
> >>
> >>Thanks in advance for any input,
> >>Dave
> >>
> >>
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]