<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE jbosscmp-jdbc PUBLIC
   "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
   "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">

<jbosscmp-jdbc>
   <defaults>
      <create-table>true</create-table>
      <remove-table>true</remove-table>
      <pk-constraint>true</pk-constraint>
   </defaults>

   <enterprise-beans>
      <entity>
         <ejb-name>PublisherEJB</ejb-name>
         <table-name>Publisher</table-name>
         <cmp-field>
            <field-name>id</field-name>
            <column-name>id</column-name>
         </cmp-field>
         <cmp-field>
            <field-name>name</field-name>
            <read-only>true</read-only>
            <read-time-out>1000</read-time-out>
            <column-name>name</column-name>
         </cmp-field>
      </entity>
      <entity>
         <ejb-name>BookEJB</ejb-name>
         <table-name>Book</table-name>
         <cmp-field>
            <field-name>id</field-name>
            <column-name>id</column-name>
         </cmp-field>
         <cmp-field>
            <field-name>name</field-name>
            <column-name>name</column-name>
         </cmp-field>
         <cmp-field>
            <field-name>isbn</field-name>
            <column-name>isbn</column-name>
         </cmp-field>
      </entity>
      <entity>
         <ejb-name>AuthorEJB</ejb-name>
         <read-only>true</read-only>
         <read-time-out>1000</read-time-out>
         <table-name>Author</table-name>
         <cmp-field>
            <field-name>id</field-name>
            <column-name>id</column-name>
         </cmp-field>
         <cmp-field>
            <field-name>name</field-name>
            <column-name>name</column-name>
         </cmp-field>
      </entity>
   </enterprise-beans>

   <relationships>
      <ejb-relation>
         <ejb-relation-name>Book-Publisher</ejb-relation-name>
         <read-only>true</read-only>
         <read-time-out>1000</read-time-out>
         <foreign-key-mapping/>
         <ejb-relationship-role>
            <ejb-relationship-role-name>publisher-has-books</ejb-relationship-role-name>
            <key-fields>
               <key-field>
                  <field-name>id</field-name>
                  <column-name>publisher</column-name>
               </key-field>
            </key-fields>
         </ejb-relationship-role>
         <ejb-relationship-role>
            <ejb-relationship-role-name>book-has-a-publisher</ejb-relationship-role-name>
            <key-fields/>
         </ejb-relationship-role>
      </ejb-relation>
   </relationships>
</jbosscmp-jdbc>
