one thing remains though, i've now implemented the role(s) thing as follows:
Person
----------
String[] roles;
Role[] getRoles();
but how does findByRole() work? can I just define a finder in the Home
class?
I mean because roles refers to a array, I think that won't work or am i
wrong?
-Alexander.
----- Original Message -----
From: "Kenworthy, Edward" <[EMAIL PROTECTED]>
To: "'jBoss'" <[EMAIL PROTECTED]>
Sent: Wednesday, December 20, 2000 3:06 PM
Subject: RE: [jBoss-User] design quesion
> That's exactly it.
>
> -----Original Message-----
> From: Alexander ten Bruggencate [mailto:[EMAIL PROTECTED]]
> Sent: 20 December 2000 13:39
> To: jBoss
> Subject: Re: [jBoss-User] design quesion
>
>
> hold it, after thinking about what you said I now think I know what you
> meant.
> I should store the primary keys of the roles a person has in the
> personbean and if findByRole("<rolename>") is called check the value of
> the parameter against the keys the person has for his/her roles and add
> the person to the list...
>
> ok. thanks again you did help!
>
> -Alexander.
>
> Alexander ten Bruggencate wrote:
>
> > Hi Edward,
> >
> > thank you for your reply.
> > The query to find people who have a certain role would be used
> > frequently,
> > so following your advice i should "maintain the appropriate foreign
> > keys and implement personHome.findByRole()"
> > erm, this leaves me with one small problem...I don't know what you
> > mean by maintaining foreign keys. :-)
> >
> > I understand the foreing keys (in this example) are the keys of all
> > the roles.
> > But other then that you've lost me...could you explain this in more
> > detail? thnx.
> >
> > And yes I agree with you on not using Bi-directonal associations.
> >
> > -Alexander.
> >
> >
> >
> > Kenworthy, Edward wrote:
> >
> >> 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]
> >>
> >>
> >>
> >
> >
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > List Help?: [EMAIL PROTECTED]
> >
> >
> >
>
>
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> List Help?: [EMAIL PROTECTED]
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> List Help?: [EMAIL PROTECTED]
>
>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]