Just so I understand this correctly-
in the object layer, I'd have a third class called WorkInfo with methods such as 
.getEmployee(), .getProject(), and .getHours()? and both Employee and Project would 
have .getWorkInfo() that would return a collection of WorkInfo objects?
 
That is a possible solution... So I suppose a HashMap or Hashtable structure would be 
impossible? (What *is* ManageableHashMap used for, anyway?)
 
In any case... Tom, thank you for the swift reply, this will definitely work.
-- 
Liam Morley
[EMAIL PROTECTED]

________________________________

From: Thomas Dudziak [mailto:[EMAIL PROTECTED]
Sent: Fri 6/18/04 1:51 PM
To: OJB Users List
Subject: Re: how to specify an attribute for a relationship?



Morley, Liam wrote:
> Let's say I have an Employee table, a Project table, and a "WorksOn" relationship 
> between those two. The relationship is m:n (one employee can work on multiple 
> projects, and multiple employees can work on the same project), and has an attribute 
> "hours" which tracks the number of hours an employee works on a given project.
>
> How do I keep track of this with OJB? Would I use a ManageableHashMap? (where 
> Employee.getHours(Project) would use the Project as the key and the hours as the 
> associated value..) If so, how would I use it? Is this even something that OJB can 
> handle? Are there other ways of doing something like this? Any advice would be much 
> appreciated.

You might decompose this into two 1:n relationships, e.g. employee <->
workinfo <-> project where the workinfo would make the indirection table
that you currently have, explicit.

For info on how to do this with OJB see the "Basic technique" tutorial:

http://db.apache.org/ojb/docu/basic-technique.html#Manual+decomposition+into+two+1%3An+associations

Tom

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