<?xml version="1.0" encoding="utf-8"?>
<entity-mappings xmlns="http://www.apache.org/openjpa/ns/orm/extendable" 
    xmlns:openjpa="http://www.apache.org/openjpa/ns/orm" 
    xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    version="2.0">
    
    <openjpa:openjpa-version version="1.0"/>
    
  <entity class="org.spec.jent.ejb.supplier.entity.PurchaseOrder">
    <table-generator name="purchaseorder" table="U_SEQUENCES"
    pk-column-name="S_ID" value-column-name="S_NEXTNUM"
    pk-column-value="purchaseorder" allocation-size="10000">
    </table-generator>
    <attributes>
    		<basic name="popularSupplier" fetch="LAZY">
    			<orm:column name="PO_POPULAR_SUPP"/>
    		</basic>
    		<basic name="sentDate" fetch="LAZY">
    			<orm:column name="PO_SENT_DATE"/>
    			<orm:temporal>DATE</orm:temporal>
    		</basic>
    		<basic name="startDate" fetch="LAZY">
    			<orm:column name="PO_START_DATE"/>
    			<orm:temporal>TIMESTAMP</orm:temporal>
    		</basic>
      <many-to-one name="supplier" fetch="LAZY">
        <orm:join-column name="PO_SUPP_ID" />
        <orm:cascade>
          <orm:cascade-merge />
        </orm:cascade>
      </many-to-one>
    </attributes>
  </entity>
	<entity class="org.spec.jent.ejb.supplier.entity.PurchaseOrderLine">

		<attributes>
			<!-- 
			<basic name="deliveryDate" fetch="LAZY">
				<orm:column name="POL_DELDATE" />
				<orm:temporal>DATE</orm:temporal>
			</basic>
			 -->
			<basic name="message" fetch="LAZY">
				<orm:column name="POL_MESSAGE" />
			</basic>
      <many-to-one name="purchaseOrder" fetch="LAZY">
        <orm:join-column name="POL_LOCATION"
        referenced-column-name="PO_SITE_ID" updatable="false"
        insertable="false" />
        <orm:join-column name="POL_PO_ID"
        referenced-column-name="PO_NUMBER" updatable="false"
        insertable="false" />
      </many-to-one>

    </attributes>
  </entity>
	<entity class="org.spec.jent.ejb.supplier.entity.SComponent">
		<attributes>
			<basic name="containerSize" fetch="LAZY">
				<orm:column name="CONTAINER_SIZE" />
			</basic>
			<basic name="cost" fetch="LAZY">
				<orm:column name="COMP_COST" />
			</basic>
			<basic name="description" fetch="LAZY">
				<orm:column name="COMP_DESC" />
			</basic>
			<basic name="name" fetch="LAZY">
				<orm:column name="COMP_NAME" />
			</basic>
			<!-- 
			<basic name="quantityDemanded" fetch="LAZY">
				<orm:column name="QTY_DEMANDED" />
			</basic>
			<basic name="quantityOnOrder" fetch="LAZY">
				<orm:column name="QTY_ON_ORDER" />
			</basic>
			 -->
			<basic name="unit" fetch="LAZY">
				<orm:column name="COMP_UNIT" />
			</basic>
		</attributes>
	</entity>
	<entity class="org.spec.jent.ejb.supplier.entity.Supplier">
		<attributes>
			<basic name="contact" fetch="LAZY">
				<orm:column name="SUPP_CONTACT"/>
			</basic>
			<basic name="name" fetch="LAZY">
				<orm:column name="SUPP_NAME"/>
			</basic>
			<openjpa:attributes>
                <openjpa:persistent name="address" fetch="LAZY"/>
            </openjpa:attributes>
		</attributes>
	</entity>	
</entity-mappings>
