Hi Alexander
Depends on how frequently you do "gives me all persons who have the role of
"Instructor"?"
If it's infrequently then don't implement an association from role-->person.
Instead just implement person-->role and then provide a method on role of
getAllPeople(). The *implementation* of which does a personHome.findAll()
for each person if role == this then add to list of matching persons.
If you do such a query frequently, or its time sensitive, then you'll have
to maintain the appropriate foreign keys and implement
personHome.findByRole(). But this means you have to maintain the foreign
key.
Basically maintaining bi-directional associations is a pain so avoid them if
you can.
Hope this helps.
Edward
-----Original Message-----
From: Alexander ten Bruggencate [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2000 11:54
To: jBoss user mailing list
Subject: [jBoss-User] design quesion
Hi all,
before i spend a lot of time implementing something which might not work
I want to know what the best way is to design something like the following:
In my application a person can have multiple roles, for example a person
can be an "Instructor" and/or a "Coordinator".
Which leads to something like
Role[] person.getRoles(); and
bool person.hasRole("Instructor");
but how do i design something that easily gives me all persons who have
the role of "Instructor"?
Is the best way for this to define a finder in RoleHome? e.g.
roleHome.findByPerson(...)?
well if someony has a working design for this I would like to know how
it looks like...
thnx,
-Alexander.
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]