<?xml version="1.0"?>

<!-- 
   - Deployment Descriptor for example: examples.cmp.basic.*
   -
   - 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>basic_CourseBean</ejb-name>

      <!-- The three files classes/interface required by all EJBs -->
      <local-home>example.cmp.basic.CourseHome</local-home>
      <local>example.cmp.basic.Course</local>
      <ejb-class>example.cmp.basic.CourseBean</ejb-class>

      <!-- Indicate you want Resin-CMP to manage database persistance. 
         - Bean Managed Persistance (BMP) is also supported, 
         - but really would defeat the point.
        -->
      <persistence-type>Container</persistence-type>

      <!-- With CMP, all entities/tables must have a unique primary key -->
      <prim-key-class>java.lang.String</prim-key-class>

      <!-- Unlike session beans, entity beans can be re-entrant.
         - However, this is discouraged by the spec
         -->
      <reentrant>True</reentrant>

      <!--
         - Name of the abstract schema for this bean's persistant data
        -->
      <abstract-schema-name>courses</abstract-schema-name>
      <!--
         - The actual database table used for the example.
        -->
      <sql-table>basic_courses</sql-table>

      <!-- Set up a cmp-field element for each property of your
         - bean that you want Resin-CMP to keep persistant.
         -
         - each entry has to me matched in the implementation class
         - with an abstract method declaration, i.e.:
         -  
         -  public abstract String getCourseId();
         -  public abstract void setCourseId(String val);
         -
         - The SQL column name will be generated from the field-name.  So
         - courseId becomes course_id.
         -
         - If the sql-column field is specified, as in the instructor
         - field below, Resin-CMP will use that as the SQL column name.
        -->
      <cmp-field>
        <field-name>id</field-name>
      </cmp-field>

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

        <!--
           - In this case, the SQL column name is different than the
           - bean's method name.
          -->
        <sql-column>teacher</sql-column>
      </cmp-field>

      <primkey-field>id</primkey-field>
    </entity>
  </enterprise-beans>

  <assembly-descriptor>
   <!-- This section is required by the spec. Resin-CMP
      - allows you to omit it and defaults to
      - the "Required" transaction scheme for all methods.
      -->
    <container-transaction>
      <method>
        <ejb-name>basic_CourseBean</ejb-name>
        <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
  </assembly-descriptor>
</ejb-jar>