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]>

Reply via email to