<ejb-jar xmlns="http://caucho.com/ns/resin">
  <enterprise-beans>
    <entity>
      <ejb-name>transaction_student</ejb-name>
      <local-home>example.cmp.transaction.StudentHome</local-home>
      <local>example.cmp.transaction.Student</local>
      <ejb-class>example.cmp.transaction.StudentBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>int</prim-key-class>
      <reentrant>True</reentrant>
      <cmp-version>2.x</cmp-version>

      <abstract-schema-name>transaction_student</abstract-schema-name>

      <cmp-field>
        <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>name</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>password</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>gender</field-name>
      </cmp-field>

      <primkey-field>id</primkey-field>

      <query>
        <query-method>
          <method-name>findByName</method-name>
          <method-params>
            <method-param>java.lang.String</method-param>
          </method-params>
        </query-method>
        <ejb-ql>
          <![CDATA[SELECT o FROM transaction_student o WHERE o.name=?1]]>
        </ejb-ql>
      </query>

    </entity>

    <entity>
      <ejb-name>transaction_course</ejb-name>
      <local-home>example.cmp.transaction.CourseHome</local-home>
      <local>example.cmp.transaction.Course</local>
      <ejb-class>example.cmp.transaction.CourseBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>int</prim-key-class>
      <reentrant>True</reentrant>

      <abstract-schema-name>transaction_course</abstract-schema-name>

      <cmp-field>
        <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>name</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>maxStudentAmount</field-name>
      </cmp-field>

      <primkey-field>id</primkey-field>

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

    <session>
      <ejb-name>transaction_registration_session</ejb-name>
      <local-home>example.cmp.transaction.RegistrationSessionHome</local-home>
      <local>example.cmp.transaction.RegistrationSession</local>
     	<ejb-class>example.cmp.transaction.RegistrationSessionBean</ejb-class>
      <session-type>Stateful</session-type>
     	<transaction-type>Container</transaction-type>
     </session>

  </enterprise-beans>

  <relationships>

    <!--
       - n-n relation between ejbql_student and ejbql_course
      -->
    <ejb-relation>
      <ejb-relation-name>transaction_student_course_mapping</ejb-relation-name>
      <ejb-relationship-role>
        <multiplicity>Many</multiplicity>
        <relationship-role-source>
          <ejb-name>transaction_student</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>courseList</cmr-field-name>
          <cmr-field-type>java.util.Collection</cmr-field-type>
        </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
        <multiplicity>Many</multiplicity>
        <relationship-role-source>
          <ejb-name>transaction_course</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>studentList</cmr-field-name>
          <cmr-field-type>java.util.Collection</cmr-field-type>
        </cmr-field>
      </ejb-relationship-role>
    </ejb-relation>

  </relationships>

  <assembly-descriptor>
    <container-transaction>
  	  <method>
  	    <ejb-name>transaction_registration_session</ejb-name>
  	    <method-intf>Remote</method-intf>
  	    <method-name>*</method-name>
  	  </method>
	    <trans-attribute>Never</trans-attribute>
    </container-transaction>
    <container-transaction>
  	  <method>
  	    <ejb-name>transaction_registration_session</ejb-name>
  	    <method-intf>Remote</method-intf>
  	    <method-name>finalizeRegistration</method-name>
  	  </method>
	    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
  	  <method>
  	    <ejb-name>transaction_student</ejb-name>
  	    <method-intf>Remote</method-intf>
  	    <method-name>Never</method-name>
  	  </method>
	    <trans-attribute>Never</trans-attribute>
    </container-transaction>
    <container-transaction>
  	  <method>
  	    <ejb-name>transaction_course</ejb-name>
  	    <method-intf>Remote</method-intf>
  	    <method-name>Never</method-name>
  	  </method>
	    <trans-attribute>Never</trans-attribute>
    </container-transaction>
  </assembly-descriptor>

</ejb-jar>