Hi Armin:

Thanks for your response. 
Now I understand what Thomas meant as key. 

But the main issue is still there for me. 
Let's take CASE A as an example:

First of all, let me summarize what I have understood: 
 
 Databases/data sources  = { Da, Db , Dc, ...., Dn }
 And I have a set of class-descrptors = 
        { { a1, a2, a3 ....,ax},
           {b1, b2, b3, ....,by},
           :::::::::::::::::::
          {n1, n2, n3, ....,nz}}
 I want to map -> 
     Class Descriptors ->{ a1,a2,::::,ax} to be mapped to [Da]
                         { b1,b2,::::,by} to be mapped to [Db]
                         { c1,c2,::::,cw} to be mapped to [Dc]
                           :::::::::::::::::::::::::::
                         { n1,n2,::::,nx} to be mapped to [Dn]
and ai != bj != ck != .....!= nl
where i,j,k,l = 1,2 ....

Now my repository xml file will look like: 
   Repository.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE descriptor-repository SYSTEM "repository.dtd"[
<!ENTITY internal SYSTEM "repository_internal.xml">
]>
<descriptor-repository version="1.0" isolation-level="read-uncommitted">
    <jdbc-connection-descriptor jcd-alias="Da" ..../>
    <jdbc-connection-descriptor jcd-alias="Db" ..../>
     :::::
    <jdbc-connection-descriptor jcd-alias="Dn" ..../>
    <class-descriptor 
            class="a1"
            table="A1"
        >
        <attribute attribute-name="DB_NAME" attribute-value="Da"/>
       :::::
     </class-descriptor>
    <class-descriptor 
            class="b1"
            table="B1"
        >
        <attribute attribute-name="DB_NAME" attribute-value="Db"/>
       :::::
     </class-descriptor>       
     :::::::::::::::
      ::::::::::
  </descriptor-repository>

And during runtime:
    To access the data: 
        My code will look like:

Object obj = ...
ClassDescriptor cld = 
MetadataManager.getInstance().getClassDescriptor(obj.getClass());
String db = cld.getAttribute("DB_NAME");
PersistenceBroker broker = PBF.createPersistenceBroker(new PBKey(db));
...

But during the deployment time: 
[ what I have found from these tutorials ] 
I also need to create a schema file for the above case...similar to
src/schema/ojbtest-schema.xml.
Now question is:
  Do I have to create:
            Different build.properties and ojbmyapp-schema.xmls for each
Di 
           Where i = 1,2,.....n 
  Or Can I can create single build.properties and ojbmyapp-schema.xml
and 
  and tell the Torque that create all a's in Da, all b's in Db ....and
n's in Dn.  

Thanks for your help and support. 
Ajitesh 
p.s: I am using your OJB in MMOG [ massive multiplayer online games ]
servers persistence engine, right now hosted in Taiwan and China and
supports 72k concurrent players .The performance is superb.!!!! Thank
you so much for providing OJB.






-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 19, 2004 11:50 AM
To: OJB Users List
Subject: Re: Repository XML limitation and design question.

Hi Ajitesch,

Ajitesh Das wrote:

> Hi Thomas:
>   Thanks for your reply. 
> I have checked the DTD of repository xml, but could not find out the
way
> to add "a key pointing to the associated ConnectionDescriptor in each
> ClassDescriptor".
> There is no such element or attribute.
> Can you give me an example of that? 
> 
Think Thomas mean that you should use custom attribute element in 
class-descriptor:

<class-descriptor
         class="org.apache.ojb.broker.ComplexReferenceTest$TeamMember"
         table="CRT_MEMBER"
     >

<attribute attribute-name="DB_NAME" attribute-value="myJcdAlias"/>

         <field-descriptor
          name="id"
          column="ROLE_ID"
          jdbc-type="INTEGER"
          primarykey="true"
          autoincrement="true"
         />
...

Then you can lookup the attribute and do something like

Object obj = ...
ClassDescriptor cld = 
MetadataManager.getInstance().getClassDescriptor(obj.getClass());
String db = cld.getAttribute("DB_NAME");
PersistenceBroker broker = PBF.createPersistenceBroker(new PBKey(db));
...

You said in your mail that you have different repository files to load -

more info how to load different object metadata please see javadoc for 
MetadataManager.

regards,
Armin

> Thanks and regards 
>  Ajitesh
> 
> 
> -----Original Message-----
> From: Thomas Mahler [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, January 17, 2004 2:57 AM
> To: OJB Users List
> Subject: Re: Repository XML limitation and design question.
> 
> Hello Ajitesh,
> 
> Case A works without any problems. You simply define a set of 
> ConnectionDescriptors and a set of ClassDescriptors in the Repository.
> In each ClassDescriptor you have a key pointing to the associated 
> ConnectionDescriptor.
> 
> Case B works too, but needs some consideration. At a given point in a 
> time given class is associated with exactly one connectionDescriptor.
> SO if you want to have a class mapped to several Connections you can
do 
> this only sequentially!
> So you you have to simply change the assigned ConnectionDescriptor key

> of the ClassDescriptor at runtime. This is done through the Metadata
> API.
> 
> cheers,
> Thomas
> 
> Ajitesh Das wrote:
> 
>>To all OJB gurus:
>>
>>  First of all this may not be a limitation on OJB what I have wrote
> 
> as
> 
>>subject but it seems that there is no easy way to handle this. 
>>
>> 
>>
>>Here is my problem : 
>>
>> 
>>
>> I like to write a repository XML file [ please note a single
> 
> repository
> 
>>file for each case] which captures the following conditions : 
>>
>> I have a set of Databases/data sources  = { Da, Db , Dc, ...., Dn } 
>>
>> 
>>
>> And I have a set of class-descrptors = 
>>
>>        { { a1, a2, a3 ....,ax},
>>
>>          {b1, b2, b3, ....,by},
>>
>>          :::::::::::::::::::
>>
>>          {n1, n2, n3, ....,nz}}
>>
>> 
>>
>> I want to map -> 
>>
>>     Class Descriptors ->{ a1,a2,::::,ax} to be mapped to [Da]
>>
>>                         { b1,b2,::::,by} to be mapped to [Db]
>>
>>                         { c1,c2,::::,cw} to be mapped to [Dc]
>>
>>                           :::::::::::::::::::::::::::
>>
>>                         { n1,n2,::::,nx} to be mapped to [Dn]
>>
>> 
>>
>>Case A:
>>
>>      Set (a)i and Set (b)j are disjoint.
>>
>>      That is: any ai != bj where i= 1,2...x
>>
>>                                  And j= 1,2,...y
>>
>>Case B: 
>>
>>      Set (a)i and Set (b)j are intersect each other.
>>
>>      That is: may be ai == bj where i= 1,2...x
>>
>>                                  And j= 1,2,...y
>>
>> 
>>
>>Has anybody did this before? 
>>
>> 
>>
>>If this can not be done in a single repository xml ...is there any way
>>it can be worked around?
>>
>> 
>>
>>Thanks 
>>
>>  Ajitesh 
>>
>> 
>>
>> 
>>
>>      
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to