You could use a class called Enrollment, which represents
the relational join table between Students and Courses. The finder
method goes in the EnrollmentHome. You're lucky, in this particular
case such a class makes sense, because Enrollment has a real world
meaning, in many other cases a 'join-class' like Enrollment doesn't
make sense (from a modeling perspective)

Frank Sauer
The Technical Resource Connection
mailto:[EMAIL PROTECTED]
http://www.trcinc.com

-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Terran Vigil
Sent: Tuesday, July 20, 1999 12:12 PM
To: [EMAIL PROTECTED]
Subject: finders for non-dependent entities


Let's say you have to two entity beans representing a manay-to-many
relationship in the database. In my case we have Courses and Students. Where
is the best place to implement a "get courses by student"?

I could add a finder to Course - .findByStudent(). However, this doesn't
seem like the clear choice since Student isn't a dependent entity of Course.
Would I be better off creating a Session bean that had a method
.getCoursesByStudent and made the JDBC call directly?

In the latter case, I could could just extract the data and not instantiate
any Entity Beans - this seems to be the trend.

Any comments?



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

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