<?xml version="1.0"?>
<!-- 
   - Deployment Descriptor for Resin-CMP example: examples.cmp.relation.one2many.*
   - 
   - 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>

    <!--
      -  House Bean
     -->
    <entity>
      <ejb-name>select_house</ejb-name>
      <local-home>example.cmp.select.HouseHome</local-home>
      <local>example.cmp.select.House</local>
      <ejb-class>example.cmp.select.HouseBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>String</prim-key-class>
      <reentrant>True</reentrant>
      <abstract-schema-name>select_house</abstract-schema-name>
    
      <cmp-field>
        <field-name>name</field-name>
      </cmp-field>

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

      <query>
        <query-method>
          <method-name>ejbSelectAllBoys</method-name>
        <method-params>
          <method-param>House</method-param>
        </method-params>
        </query-method>
        <ejb-ql>
          <![CDATA[SELECT student.name FROM select_house house, IN(house.studentList) student WHERE student.gender='Boy' AND house=?1]]>
        </ejb-ql>
      </query>

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

    <!--
      -  Student Bean
     -->
    <entity>
      <ejb-name>select_student</ejb-name>
      <local-home>example.cmp.select.StudentHome</local-home>
      <local>example.cmp.select.Student</local>
      <ejb-class>example.cmp.select.StudentBean</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>select_student</abstract-schema-name>

      <cmp-field>
        <field-name>name</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>gender</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 select_student o]]>
        </ejb-ql>
      </query>

    </entity>
 </enterprise-beans>

 <relationships>
   <ejb-relation>
      <ejb-relationship-role>
        <multiplicity>One</multiplicity>
        <relationship-role-source>
          <ejb-name>select_house</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>studentList</cmr-field-name>
        </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
        <multiplicity>Many</multiplicity>
        <relationship-role-source>
          <ejb-name>select_student</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>house</cmr-field-name>
        </cmr-field>
      </ejb-relationship-role>
    </ejb-relation>  
 </relationships>

</ejb-jar>