Discussions

EJB programming & troubleshooting: Using ejbSelect Methods

  1. Using ejbSelect Methods (5 messages)

    hi,

    I have a question regarding the use of ejbSelect methods. I have two entity beans StudentEJB and CourseEJB which have a M:N relationship with each other with the studentId variable of StudentEJB being related to the courseNo variable of CourseEJB. Can ejbSelect methods be used to determine in such a case the courses that a student is enrolled in instead of using session tracking to track the student's id and then retrieve the courses based on studentId.

    Threaded Messages (5)

  2. Using ejbSelect Methods[ Go to top ]

    Plz. Reframd your question Again.
    Data Insufficient
  3. Using ejbSelect Methods[ Go to top ]

    Plz. Reframe your question Again.
    Data Insufficient
  4. Using ejbSelect Methods[ Go to top ]

    Anything is possible.
  5. Using ejbSelect Methods[ Go to top ]

    Well, not ANYTHING.
  6. Hi,
     In ur case Student Entity registed with many courses [CoursesBean] . by using 1:N relationship implemented in deployment descriptor.

    public class Student implements EntityBean
    {

     public abstract void setCourse (Collection Courses)
     public abstract Collection getCourse ()
     
    //CallBack Methods...
    }



    <relationships>
    <ejb-relation>

    <ejb-relation-name> student-course </ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-rolename>student-courses </ejb-relationship-rolename>
    <multiplicity>One </multiplicity>
    <ejb-relationship-rolesource> Student </ejb-relationship-rolesource>
    <cmr-field>
    <cmr-fieldname>Courses <cmr-fieldname>
    <cmr-fieldtype>java.util.Collection <cmr-fieldtype>
    </cmrfield>
    <ejb-relationship-role>


    <ejb-relationship-role>
    <ejb-relationship-rolename>many-courses </ejb-relationship-rolename>
    <multiplicity>Many</multiplicity>
    <ejb-relationship-rolesource> Courses</ejb-relationship-rolesource>
    </ejb-relationship-role>
    <ejb-relation>
    <relationships>