If I have two classes Foo and Bar, each represented by an entity bean class,
and there is a "valued relationship" between objects of these two types, what
is the best way to implement that in EJB?

By "valued relationship" (there's a probably a better term for this), I mean a
class which represents a relationship between two other classes, but which also
contains an intrinsic value.

For instance, if I have a "Student" class, and a "Class" class (I'd like to
find a better term for that one, too), there is a conceptual "Grade" class,
which represents a grade value for a Student in a Class.

I started examining whether it made sense for "Grade" to also be an Entity
Bean, but it looks somewhat odd.  Obviously, the primary key would be
"Student+Class".

It seems to make more sense for this to be a Stateless Session Bean with
methods like:

1. Set grade for Student and Class.  This will either update a row or insert a
new row.

2. Get grade for Student and Class.  This would return a string, either an
empty string (no grade yet), or a string representation of a float (1.0-5.0).

3. Remove Student/Class assocation.  This just removes the row.

Although I'll have to write more JDBC code, I won't have to deal with the
two-column primary key, which presents its own complications (which I don't
fully understand).

I'd appreciate any thoughts people have on these issues, or references to
relevant articles.

--
===================================================================
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".

Reply via email to