>>>>> "Evan" == Evan Ireland <[EMAIL PROTECTED]> writes:
Evan> "David M. Karr" wrote:
>>
>> In an experimental application I'm building, I have two entities, named
>> "Student" and "Class" (no name conflict, I use "ClassBean", "ClassHome", etc.).
>>
>> I also have an entity named "StudentClassGrade". This essentially reflects a
>> "valued association", referencing a Student and Class, and containing a Grade
>> value.
>>
>> My first question is, what should be the types of the "Student" and "Class"
>> references in "StudentClassGrade" be? Should they be the remote references, or
>> the primary keys? The primary keys of "Student" and "Class" are, respectively,
>> "String ssn" and "String name".
>>
>> Then, dependent on that, my PK class for "StudentClassGrade" will be a compound
>> key. I'm fairly certain this should contain the two primary keys of the
>> associated Student and Class, but I'm not quite sure how this should work.
Evan> Yes that would be reasonable.
Evan> Then you can add methods: findByStudent and findByClass to the home interface
Evan> of your 'relationship' entity. When you find an entity, call a method
Evan> getGrade() to fetch the grade.
These are clear, but there's lots of details that I think I'm supposed to be
covering, but I can't find enough reasonable documentation.
For instance, does it matter what the NAMES of the fields in the primary key
are? I thought I'd read that they either have to, or should, be the names of
the associated fields in the bean.
Another issue: what would "findByPrimaryKey" look like?
>> I'm having a lot of trouble finding good documentation and examples for this
>> sort of thing. I've found umpteen examples of trivial beans and PKs, but
>> nothing like this. I was hoping the new "Professional EJB" book would cover
>> this well, but it doesn't.
Again, is there anything I can read that covers development of more than
completely trivial primary keys and finders?
--
===================================================================
David M. Karr ; Best Consulting
[EMAIL PROTECTED] ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".