But, if the representation is "collection of primitives" instead of "collection of 
objects" ,
Do we need to create a sepetrate table. 
How do we represent multi-valued primitive attribute ?
For eg: 
   class MyObj { 
      int[] winningNumbers; 
      public int[] getWiningNumbers()
     { return winingNumbers;}
     public  void setWiningNumbers (int[] no)
     { winingNumbers = no;}
}
 
how do we represent the "winingNumbers" field.
 
thanks 
 
 
-----Original Message----- 
From: Mahler Thomas [mailto:[EMAIL PROTECTED]] 
Sent: Mon 1/20/2003 7:33 AM 
To: 'OJB Users List' 
Cc: 
Subject: AW: How to represent a collection of objects in OJB



        sure, why not?
        
        if you don't have a collection-descriptor for a given attribute, it won't be
        persisted to the db.
        
        You can fill the workstations attribute with
        broker.getCollectionByQuery(...)
        
        cheers,
        Thomas
        
        > -----Ursprüngliche Nachricht-----
        > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
        > Gesendet: Montag, 20. Januar 2003 16:31
        > An: [EMAIL PROTECTED]
        > Betreff: RE: How to represent a collection of objects in OJB
        >
        >
        > Hi Thomas,
        >
        > With your solution you store the collection "workstations" in
        > the database, right?
        > In fact I don't need to store this collection because it's a
        > dynamic result of a query to the Workstation table.
        >
        > Is there a solution without using the database?
        >
        > Regards
        > Sylvain
        >
        >
        > -----Message d'origine-----
        > De: Mahler Thomas [mailto:[EMAIL PROTECTED]]
        > Date: lundi, 20. janvier 2003 15:16
        > À: 'OJB Users List'
        > Objet: RE: How to represent a collection of objects in OJB
        >
        >
        > Hi,
        >
        > > Hello,
        > >
        > > I'm using OJB and I'm asking something:
        > >
        > > I have a class called Workstation that represent a
        > > workstation. There is a table "Workstation" in the database
        > > and OJB provides the link between.
        > >
        > > My question is:
        > > I need to represent a collection (or a Node) of workstations
        > > in the class Workstation because I use this class as a model
        > > in a MVC environment.
        > > Is it possible?
        >
        > Yes. OJB can handle such reursive associations without problems.
        >
        > > How to do that without causing problem in the mapping?
        >
        > 1. add a collection attribute "workstations" to the class Workstation
        > this collection will hold the associated workstations.
        >
        > 2. you have to decide wether this assosciation is 1:n or m:n.
        > for 1:n you just need an additional foreignkey attribute in
        > the WORKSTATION
        > table.
        > Of course you'll also need a matching attribute in the class
        > Workstation.
        >
        > For a m:n association you'll have to define a intermediary
        > table to hold the
        > mapping entries.
        >
        > 3. define a collection-descriptor in repository.xml.
        > Follow the steps in tutorial3.html on 1:n and m:n.
        >
        >
        > cheers,
        > Thomas
        >
        >
        > >
        > > Thank you
        > > Sylvain
        > >
        > > --
        > > To unsubscribe, e-mail:  
        > > <mailto:[EMAIL PROTECTED]>
        > > For additional commands, e-mail:
        > > <mailto:[EMAIL PROTECTED]>
        > >
        > >
        >
        >
        > --
        > To unsubscribe, e-mail:  
        > <mailto:[EMAIL PROTECTED]>
        > For additional commands, e-mail:
        > <mailto:[EMAIL PROTECTED]>
        >
        >
        > --
        > To unsubscribe, e-mail:  
        > <mailto:[EMAIL PROTECTED]>
        > For additional commands, e-mail:
        > <mailto:[EMAIL PROTECTED]>
        >
        >
        
        
        --
        To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
        For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
        
        

<<winmail.dat>>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


Reply via email to