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