Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EclipseLink/Development/200040/employee-map.xml

This page illustrates the new EclipseLink ORM XML based on the conversion of the existing TopLink version of the file:

New EclipseLink-ORM.XML

<?xml version="1.0" encoding="windows-1252" ?>
<entity-mappings 
	xmlns="http://www.eclipse.org/eclipselink/xsds/orm"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/orm http://www.eclipse.org/eclipselink/xsds/eclipselink-orm_1_0.xsd"
	version="1.0" >
 
	<entity class="model.LargeProject">
		<table name="LPROJECT"/>
		<inheritance strategy="TABLE_PER_CLASS"/>
		<discriminator-value>L</discriminator-value>
		<discriminator-column name="PROJ_TYPE"/>
		<attributes>
			<basic name="budget"/>
			<basic name="milestone"/>
		</attributes>
	</entity>
 
	<entity class="model.Project">
		<cache type="SOFT-WEAK" size=100>
		<attributes>
			<id name="id">
				<column name="PROJ_ID"/>
			</id>
			<basic name="description">
				<column name="DESCRIP"/>
			</basic>
			<basic name="name">
				<column name="PROJ_NAME"/>
			</basic>
			<basic name="version"/>
			<many-to-one name="teamLeader">
				<join-column name="LEADER_ID"/>
			</many-to-one>
		</attributes>
	</entity>
 
	<entity class="model.Address">
		<cache type="SOFT-WEAK" size=100>
		<attributes>
			<id name="id">
				<column name="ADDRESS_ID" updatable="false"/>
			</id>
			<basic name="city"/>
			<basic name="country"/>
			<basic name="province"/>
			<basic name="postalCode">
				<column name="P_CODE"/>
			</basic>
			<basic name="street"/>
		</attributes>
	</entity>
 
	<entity class="model.PhoneNumber">
		<table name="PHONE" />
		<cache type="SOFT-WEAK" size=100>
		<attributes>
			<id name="id">
				<column name="EMP_ID"/>
			</id>
			<id name="type">
				<column updatable="false"/>
			</id>
			<basic name="areaCode">
				<column name="AREA_CODE"/>
			</basic>
			<basic name="number">
				<column name="P_NUMBER"/>
			</basic>
			<many-to-one name="owner">
				<join-column name="EMP_ID"/>
			</many-to-one>
		</attributes>
		<!-- Named Query using Expression -->
	</entity>
 
	<entity class="model.Employee">
		<secondary-table name="SALARY"/>
		<attributes>
			<id name="id">
				<column name="EMP_ID" updatable="false"/>
			</id>
			<basic name="firstName">
				<column name="F_NAME"/>
			</basic>
			<basic name="gender"/>
			<basic name="lastName">
				<column name="L_NAME"/>
			</basic>
			<basic name="startTime">
				<column name="START_TIME"/>
				<temporal>TIME</temporal>
			</basic>
			<basic name="endTime">
				<column name="END_TIME"/>
				<temporal>TIME</temporal>
			</basic>
			<version name="version"/>
			<basic name="salary">
				<column name="SALARY" table="SALARY"/>
			</basic>
			<many-to-one name="manager">
				<join-column name="MANAGER_ID"/>
			</many-to-one>
			<one-to-many name="managedEmployees" mapped-by="manager"/>
			<one-to-many name="phoneNumbers" mapped-by="owner"/>
			<one-to-one name="address">
				<join-column name="ADDR_ID"/>
			</one-to-one>
			<many-to-many name="projects">
				<join-table name="PROJ_EMP">
					<join-column name="EMP_ID"/>
					<inverse-join-column name="PROJ_ID"/>
				</join-table>
			</many-to-many>
			<embedded name="period">
				<attribute-override name="startDate">
					<column name="START_DATE"/>
				</attribute-override>
				<attribute-override name="endDate">
					<column name="END_DATE"/>
				</attribute-override>
			</embedded>
 
			<!-- Bug 211300: TransformationMapping -->
			<transformation name="normalHours">
				<read-method name="buildNormalHours">
				<write-method name="getStartTime">
					<column name="START_TIME"/>
				</write-method>
				<write-method name="getEndTime">
					<column name="END_TIME"/>
				</write-method>
			</transformation>
		</attributes>
	</entity>
 
	<entity class="model.SmallProject">
		<table name="PROJECT">
		</table>
		<inheritance strategy="JOINED"></inheritance>
		<discriminator-value>S</discriminator-value>
	</entity>
 
	<embeddable class="model.EmploymentPeriod">
		<attributes>
			<basic name="startDate" />
			<basic name="endDate" />
		</attributes>
	</embeddable>
 
</entity-mappings>

Back to the top