<?xml version="1.0" encoding="utf-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
	version="1.0">
	<entity class="org.spec.jent.ejb.mfg.entity.WorkOrder">
		<table-generator name="workorder" table="U_SEQUENCES"
			pk-column-name="S_ID" value-column-name="S_NEXTNUM" pk-column-value="workorder"
			allocation-size="280000">
		</table-generator>
	</entity>
	
	<!--BOM -->
	<entity class="org.spec.jent.ejb.mfg.entity.Bom">
		<attributes>
			<basic name="engChange" fetch="LAZY">
				<column name="B_ENG_CHANGE"/>
			</basic>
			<basic name="opsDesc" fetch="LAZY">
				<column name="B_OPS_DESC"/>
			</basic>
			<basic name="opsNo" fetch="LAZY">
				<column name="B_OPS"/>
			</basic>		
			<many-to-one name="component" fetch="EAGER">
				<join-column name="B_COMP_ID" updatable="false" insertable="false" />
			</many-to-one>
			<many-to-one name="assembly" fetch="LAZY">
				<join-column name="B_ASSEMBLY_ID" updatable="false" insertable="false" />
			</many-to-one>
		</attributes>
	</entity>

	<entity class="org.spec.jent.ejb.mfg.entity.Component">
		<attributes>
			<basic name="description" fetch="LAZY">
				<column name="P_DESC"/>
			</basic>
			<basic name="name" fetch="LAZY">
				<column name="P_NAME"/>
			</basic>
			<basic name="planner" fetch="LAZY">
				<column name="P_PLANNER"/>
			</basic>
			<basic name="purchased" fetch="LAZY">
				<column name="P_IND" updatable="false" insertable="false"/>
			</basic>	
            <basic name="revision" fetch="LAZY">
				<column name="P_REV"/>
			</basic>
            <basic name="type" fetch="LAZY">
				<column name="P_TYPE"/>
			</basic>			
			<one-to-many name="componentBoms" fetch="LAZY" mapped-by="component"/>
		</attributes> 
	</entity>
	<entity class="org.spec.jent.ejb.mfg.entity.Assembly">
		<attributes>
			<one-to-many name="assemblyBoms" fetch="LAZY" mapped-by="assembly" />
		</attributes>
	</entity>

	<!-- Inventory -->
	<entity class="org.spec.jent.ejb.mfg.entity.Inventory">
		<attributes>
			<basic name="accCode" fetch="LAZY">
				<column name="IN_ACC_CODE"/>
			</basic>
			<basic name="accDate" fetch="LAZY">
				<column name="IN_ACT_DATE"/>
				<temporal>TIMESTAMP</temporal>
			</basic>		
			<many-to-one name="component" fetch="LAZY">
				<join-column name="IN_P_ID" updatable="false" insertable="false" />
			</many-to-one>
		</attributes>
	</entity>
</entity-mappings>
