<?xml version="1.0"?>

<!-- 
   - Deployment Descriptor: example.cmp.create.*
   -
   - 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>create_CourseBean</ejb-name>

      <!-- The three files classes/interface required by all EJBs -->
      <local-home>example.cmp.create.CourseHome</local-home>
      <local>example.cmp.create.Course</local>
      <ejb-class>example.cmp.create.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>False</reentrant>

      <!-- Name of the database table Resin-CMP uses to store 
         - this bean's persistant data
         -->
      <abstract-schema-name>create_courses</abstract-schema-name>

      <!-- 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 );
         -
         - these will be implemented by Resin-CMP at deploy-time.
         -
         -->
      <cmp-field>
        <field-name>courseId</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>instructor</field-name>
      </cmp-field>

      <primkey-field>courseId</primkey-field>

      <query>
        <!--
           - Each query element pertains to a particular method.
           - You need to define the method in the local interface, i.e.
           -  public Collection findAll()
           -    throws FinderException;
          --> 
         <query-method>
           <method-name>findAll</method-name>
          </query-method>

        <!-- EJB-QL is a generic query languages that Resin-CMP can translate
           - to datastore-specific formats, such as SQL.
           -->
        <ejb-ql>
          <![CDATA[SELECT o FROM create_courses o]]>
        </ejb-ql>
      </query>
    </entity>
  </enterprise-beans>

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