<?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.orders.entity.CustomerInventory">
		<table-generator name="inventory" table="U_SEQUENCES"
			pk-column-name="S_ID" value-column-name="S_NEXTNUM" pk-column-value="inventory"
			allocation-size="10000">
		</table-generator>
		<attributes>
			<many-to-one name="vehicle" fetch="LAZY">
				<orm:join-column name="CI_ITEMID" />
				<orm:cascade>
					<orm:cascade-merge />
				</orm:cascade>
			</many-to-one>
			<many-to-one name="customer" fetch="LAZY">
				<orm:join-column name="CI_CUSTOMERID"/>
				<orm:cascade>
					<orm:cascade-merge />
				</orm:cascade>
			</many-to-one>
		</attributes>
	</entity>
	<entity class="org.spec.jent.ejb.orders.entity.Customer">
		<attributes>
			<basic name="contact" fetch="LAZY">
				<orm:column name="C_CONTACT"/>
			</basic>    
			<basic name="ytdPayment" fetch="LAZY">
				<orm:column name="C_YTD_PAYMENT"/>
			</basic>
			<one-to-many name="customerInventories" mapped-by="customer" fetch="LAZY">
				<orm:cascade>
					<orm:cascade-all />
				</orm:cascade>
			</one-to-many>
		    <openjpa:attributes>
                <openjpa:persistent name="address" fetch="LAZY"/>
            </openjpa:attributes>
		</attributes>
	</entity>
	<entity class="org.spec.jent.ejb.orders.entity.Order">
		<table-generator name="order" table="U_SEQUENCES"
			pk-column-name="S_ID" value-column-name="S_NEXTNUM" pk-column-value="order"
			allocation-size="200000">
		</table-generator>
		<attributes>
			<basic name="shipDate" fetch="LAZY">
				<orm:column name="O_SHIP_DATE"/>
				<orm:temporal>TIMESTAMP</orm:temporal>
			</basic>
			<many-to-one name="customer" fetch="LAZY">
				<orm:join-column name="O_C_ID" />
				<orm:cascade>
					<orm:cascade-merge />
				</orm:cascade>
			</many-to-one>
		</attributes>
	</entity>
	<entity class="org.spec.jent.ejb.orders.entity.OrderLine">
		<attributes>
			<basic name="msrpAtPurchase" fetch="LAZY">
				<orm:column name="OL_MSRP"/>
			</basic>
			<basic name="shipDate" fetch="LAZY">
				<orm:column name="OL_SHIP_DATE"/>
			</basic>		
			<many-to-one name="item" fetch="LAZY">
				<orm:join-column name="OL_I_ID" />
				<orm:cascade>
					<orm:cascade-merge />
				</orm:cascade>
			</many-to-one>
			<many-to-one name="order" fetch="LAZY">
				<orm:join-column name="OL_O_ID" updatable="false"
					insertable="false" />
			</many-to-one>
		</attributes>
	</entity>
</entity-mappings>
