<?xml version="1.0"?>

<!-- 
   - Deployment Descriptor for Resin-CMP example: examples.session.stateful.*
   - 
   - The EJB 2.0 spec requires you to name this file ejb-jar.xml
   - and place it in BEAN_BASE/META-INF, where BEAN_BASE is the
   - location where you store class files referenced by this
   - descriptor.
   -
   - To make development less of a hassle, Resin-CMP will recognize
   - all *.ejb files that are stored in EjbServlet's WEB-INF
   - directory as deployment descriptors.
  -->

<ejb-jar xmlns="http://caucho.com/ns/resin">
<enterprise-beans>
  <entity>
    <ejb-name>one2one_teachers</ejb-name>

    <local-home>example.cmp.one2one.TeacherHome</local-home>
    <local>example.cmp.one2one.Teacher</local>
    <ejb-class>example.cmp.one2one.TeacherBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>String</prim-key-class>
    <reentrant>True</reentrant>
    <cmp-version>2.x</cmp-version>

    <abstract-schema-name>one2one_teachers</abstract-schema-name>

    <cmp-field>
      <field-name>name</field-name>
    </cmp-field>

    <primkey-field>name</primkey-field>

  </entity>

  <entity>
    <ejb-name>one2one_courses</ejb-name>
    <local-home>example.cmp.one2one.CourseHome</local-home>
    <local>example.cmp.one2one.Course</local>
    <ejb-class>example.cmp.one2one.CourseBean</ejb-class>

    <persistence-type>Container</persistence-type>
    <prim-key-class>String</prim-key-class>
    <reentrant>True</reentrant>
    <abstract-schema-name>one2one_courses</abstract-schema-name>

    <cmp-field>
      <field-name>name</field-name>
    </cmp-field>

    <primkey-field>name</primkey-field>

    <query>
      <query-method>
        <method-name>findAll</method-name>
        <method-params/>
       </query-method>
       <ejb-ql>
        <![CDATA[SELECT o FROM one2one_courses o]]>
       </ejb-ql>
    </query>
  </entity>
</enterprise-beans>

<!-- set up the one-to-one relationship -->
<relationships>
  <ejb-relation>

    <ejb-relationship-role>
      <multiplicity>One</multiplicity>
      <relationship-role-source>
         <ejb-name>one2one_teachers</ejb-name>
      </relationship-role-source>
      <cmr-field>
        <cmr-field-name>course</cmr-field-name>
      </cmr-field>
    </ejb-relationship-role>

    <ejb-relationship-role>
      <multiplicity>One</multiplicity>  
      <relationship-role-source>
        <ejb-name>one2one_courses</ejb-name>
      </relationship-role-source>
      <cmr-field>
        <cmr-field-name>teacher</cmr-field-name>
      </cmr-field>
    </ejb-relationship-role>
  </ejb-relation>
</relationships>
</ejb-jar>
