blob: 99ae1fa5cf85f8560485161022a38907255f2013 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0,
or the Eclipse Distribution License v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
-->
<entity-mappings version="2.0" 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 orm_2_0.xsd">
<description>Advanced Test Model Instance Document</description>
<entity name="XMLEmployee" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee" access="PROPERTY">
<table name="CMP3_XML_EMPLOYEE"/>
<secondary-table name="CMP3_XML_SALARY">
<primary-key-join-column name="E_ID" referenced-column-name="EMP_ID"/>
</secondary-table>
<table-generator name="XML_EMPLOYEE_TABLE_GENERATOR" table="CMP3_XML_EMPLOYEE_SEQ" pk-column-name="SEQ_NAME" value-column-name="SEQ_COUNT" pk-column-value="XML_EMPLOYEE_SEQ"/>
<named-query name="findAllXMLEmployeesByFirstName">
<query>SELECT OBJECT(employee) FROM XMLEmployee employee WHERE employee.firstName = :firstname</query>
</named-query>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<entity-listeners>
<entity-listener class="org.eclipse.persistence.testing.models.jpa.xml.advanced.EmployeeListener">
<pre-persist method-name="prePersist"/>
<post-persist method-name="postPersist"/>
<pre-remove method-name="preRemove"/>
<post-remove method-name="postRemove"/>
<pre-update method-name="preUpdate"/>
<post-update method-name="postUpdate"/>
<post-load method-name="postLoad"/>
</entity-listener>
</entity-listeners>
<attributes>
<id name="id">
<column name="EMP_ID"/>
<generated-value strategy="TABLE" generator="XML_EMPLOYEE_TABLE_GENERATOR"/>
</id>
<basic name="firstName" access="FIELD">
<column name="F_NAME"/>
</basic>
<basic name="lastName" access="FIELD">
<column name="L_NAME"/>
</basic>
<basic name="salary">
<column table="CMP3_XML_SALARY"/>
</basic>
<basic name="payScale">
<column name="PAY_SCALE"/>
<enumerated>STRING</enumerated>
</basic>
<version name="version">
<column name="VERSION"/>
</version>
<many-to-one name="address" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Address" fetch="LAZY">
<join-column name="ADDR_ID"/>
<cascade>
<cascade-persist/>
</cascade>
</many-to-one>
<many-to-one name="manager" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee" fetch="LAZY">
<join-column name="MANAGER_EMP_ID" referenced-column-name="EMP_ID"/>
<cascade>
<cascade-persist/>
</cascade>
</many-to-one>
<many-to-one name="department" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Department" fetch="EAGER">
<join-column name="DEPT_ID" referenced-column-name="ID"/>
</many-to-one>
<one-to-many name="phoneNumbers" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.PhoneNumber" mapped-by="owner">
<cascade>
<cascade-all/>
</cascade>
</one-to-many>
<one-to-many name="managedEmployees" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee" mapped-by="manager">
<cascade>
<cascade-all/>
</cascade>
</one-to-many>
<one-to-many name="dealers" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Dealer">
<join-column name="FK_EMP_ID"/>
<cascade>
<cascade-persist/>
<cascade-merge/>
</cascade>
</one-to-many>
<many-to-many name="projects" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Project">
<order-by>name</order-by>
<join-table name="CMP3_XML_PROJ_EMP">
<join-column name="EMP_ID" referenced-column-name="EMP_ID"/>
<inverse-join-column name="PROJ_ID" referenced-column-name="PROJ_ID"/>
</join-table>
<cascade>
<cascade-persist/>
</cascade>
</many-to-many>
<embedded name="period">
<attribute-override name="startDate">
<column name="START_DATE" nullable="false"/>
</attribute-override>
<attribute-override name="endDate">
<column name="END_DATE" nullable="true"/>
</attribute-override>
</embedded>
<transient name="responsibilities"/>
</attributes>
</entity>
<entity name="XMLAddress" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Address" access="PROPERTY">
<table name="CMP3_XML_ADDRESS"/>
<sequence-generator name="XML_ADDRESS_SEQUENCE_GENERATOR" sequence-name="ADDRESS_SEQ" allocation-size="25"/>
<named-query name="findAllXMLAddressesByPostalCode">
<query>SELECT OBJECT(address) FROM XMLAddress address WHERE address.postalCode = :postalcode</query>
</named-query>
<named-native-query name="findAllXMLAddresses" result-class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Address">
<query>SELECT * FROM CMP3_XML_ADDRESS</query>
</named-native-query>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="id">
<column name="ADDRESS_ID"/>
<generated-value strategy="SEQUENCE" generator="XML_ADDRESS_SEQUENCE_GENERATOR"/>
</id>
<basic name="postalCode">
<column name="P_CODE"/>
</basic>
<basic name="street"/>
<basic name="city"/>
<basic name="province"/>
<basic name="country"/>
</attributes>
</entity>
<entity name="XMLPhoneNumber" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.PhoneNumber" access="PROPERTY">
<table name="CMP3_XML_PHONENUMBER"/>
<id-class class="org.eclipse.persistence.testing.models.jpa.xml.advanced.PhoneNumberPK"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="id">
<column name="OWNER_ID" insertable="false" updatable="false"/>
</id>
<id name="type">
<column name="TYPE"/>
</id>
<basic name="number">
<column name="NUMB"/>
</basic>
<basic name="areaCode">
<column name="AREA_CODE"/>
</basic>
<many-to-one name="owner" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee" access="FIELD">
<join-column name="OWNER_ID" referenced-column-name="EMP_ID"/>
</many-to-one>
</attributes>
</entity>
<entity name="XMLLargeProject" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.LargeProject" access="PROPERTY">
<table name="CMP3_XML_LPROJECT"/>
<discriminator-value>L</discriminator-value>
<named-query name="findXMLWithBudgetLargerThan">
<query>SELECT OBJECT(project) FROM XMLLargeProject project WHERE project.budget >= :amount</query>
</named-query>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
</entity>
<entity name="XMLSmallProject" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.SmallProject" access="PROPERTY">
<table name="CMP3_XML_PROJECT"/>
<discriminator-value>S</discriminator-value>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
</entity>
<entity name="XMLProject" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Project" access="FIELD">
<table name="CMP3_XML_PROJECT"/>
<inheritance strategy="JOINED"/>
<discriminator-value>P</discriminator-value>
<discriminator-column name="PROJ_TYPE"/>
<sequence-generator name="XML_PROJECT_SEQUENCE_GENERATOR" sequence-name="PROJECT_SEQ" allocation-size="10"/>
<named-query name="findXMLProjectByName">
<query>SELECT OBJECT(project) FROM XMLProject project WHERE project.name = :name</query>
</named-query>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<pre-persist method-name="prePersist"/>
<post-persist method-name="postPersist"/>
<pre-remove method-name="preRemove"/>
<post-remove method-name="postRemove"/>
<pre-update method-name="preUpdate"/>
<post-update method-name="postUpdate"/>
<post-load method-name="postLoad"/>
<attributes>
<id name="id">
<column name="PROJ_ID"/>
<generated-value strategy="SEQUENCE" generator="XML_PROJECT_SEQUENCE_GENERATOR"/>
</id>
<basic name="name">
<column name="PROJ_NAME"/>
</basic>
<basic name="description">
<column name="DESCRIP"/>
</basic>
<version name="version">
<column name="VERSION"/>
</version>
<one-to-one name="teamLeader" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee" access="PROPERTY">
<join-column name="LEADER_ID"/>
</one-to-one>
<many-to-many name="teamMembers" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee" mapped-by="projects" access="PROPERTY"/>
<transient name="pre_update_count"></transient>
<transient name="post_update_count"></transient>
<transient name="pre_remove_count"></transient>
<transient name="post_remove_count"></transient>
<transient name="pre_persist_count"></transient>
<transient name="post_persist_count"></transient>
<transient name="post_load_count"></transient>
</attributes>
</entity>
<entity name="XMLAdvancedCustomer" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Customer" access="PROPERTY">
<table name="CMP3_XML_ADV_CUSTOMER"/>
<table-generator name="XML_ADV_CUSTOMER_TABLE_GENERATOR" table="CMP3_XML_EMPLOYEE_SEQ" pk-column-name="SEQ_NAME" value-column-name="SEQ_COUNT" pk-column-value="XML_ADV_CUSTOMER_SEQ"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="id">
<column name="CUSTOMER_ID"/>
<generated-value strategy="TABLE" generator="XML_ADV_CUSTOMER_TABLE_GENERATOR"/>
</id>
<basic name="firstName">
<column name="F_NAME"/>
</basic>
<basic name="lastName">
<column name="L_NAME"/>
</basic>
<basic name="budget"/>
<version name="version">
<column name="VERSION"/>
</version>
</attributes>
</entity>
<entity name="XMLDealer" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Dealer" access="PROPERTY">
<table name="CMP3_XML_DEALER"/>
<table-generator name="XML_DEALER_TABLE_GENERATOR" table="CMP3_XML_EMPLOYEE_SEQ" pk-column-name="SEQ_NAME" value-column-name="SEQ_COUNT" pk-column-value="XML_DEALER_SEQ"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="id">
<column name="DEALER_ID"/>
<generated-value strategy="TABLE" generator="XML_DEALER_TABLE_GENERATOR"/>
</id>
<basic name="firstName">
<column name="F_NAME"/>
</basic>
<basic name="lastName">
<column name="L_NAME"/>
</basic>
<basic name="businessId" access="FIELD">
<column name="BID"/>
</basic>
<basic name="status"/>
<version name="version">
<column name="VERSION"/>
</version>
<one-to-many name="customers" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Customer">
<join-column name="FK_DEALER_ID"/>
<cascade>
<cascade-persist/>
<cascade-merge/>
</cascade>
</one-to-many>
</attributes>
</entity>
<entity name="XMLMan" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Man" access="PROPERTY">
<table name="XML_MAN"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="id">
<generated-value strategy="IDENTITY"/>
</id>
<basic name="firstName">
<column name="F_NAME"/>
</basic>
<basic name="lastName">
<column name="L_NAME"/>
</basic>
<one-to-one name="partnerLink" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.PartnerLink" mapped-by="man"/>
</attributes>
</entity>
<entity name="XMLWoman" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Woman" access="PROPERTY">
<table name="XML_WOMAN"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="id">
<generated-value strategy="IDENTITY"/>
</id>
<basic name="firstName">
<column name="F_NAME"/>
</basic>
<basic name="lastName">
<column name="L_NAME"/>
</basic>
<one-to-one name="partnerLink" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.PartnerLink" mapped-by="woman"/>
</attributes>
</entity>
<entity name="XMLPartnerLink" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.PartnerLink" access="PROPERTY">
<table name="XML_MW"/>
<id-class class="org.eclipse.persistence.testing.models.jpa.xml.advanced.PartnerLinkPK"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<one-to-one name="man" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Man" id="true">
<join-column name="M"/>
<cascade>
<cascade-persist/>
</cascade>
</one-to-one>
<one-to-one name="woman" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Woman" id="true">
<join-column name="W"/>
<cascade>
<cascade-persist/>
</cascade>
</one-to-one>
</attributes>
</entity>
<entity name="XMLADVDepartment" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.Department" access="PROPERTY">
<table name="CMP3_XML_DEPT"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="id">
<generated-value strategy="TABLE"/>
</id>
<basic name="name"/>
<one-to-many name="employees" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee" mapped-by="department"/>
<one-to-one name="departmentHead" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee">
<join-column name="DEPT_HEAD"/>
</one-to-one>
</attributes>
</entity>
<entity name="XMLCubicle" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.Cubicle" access="PROPERTY">
<table name="CMP3_XML_CUBICLE"/>
<id-class class="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.CubiclePK"/>
<table-generator name="XML_COMPOSITE_PK_TABLE_GENERATOR" table="CMP3_XML_COMPOSITE_PK_SEQ" pk-column-name="SEQ_NAME" value-column-name="SEQ_COUNT" pk-column-value="XML_CUBICLE_SEQ"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="id">
<generated-value strategy="TABLE" generator="XML_COMPOSITE_PK_TABLE_GENERATOR"/>
</id>
<id name="code" >
<column name="CODE"/>
</id>
<one-to-one name="scientist" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.Scientist" mapped-by="cubicle">
</one-to-one>
</attributes>
</entity>
<entity name="XMLDepartment" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.Department" access="PROPERTY">
<table name="CMP3_XML_DEPARTMENT"/>
<id-class class="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.DepartmentPK"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="name" >
<column name="NAME"/>
</id>
<id name="role" >
<column name="DEPT_ROLE"/>
</id>
<id name="location" >
<column name="LOCATION"/>
</id>
<one-to-many name="scientists" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.Scientist" fetch="EAGER" mapped-by="department">
<order-by/>
</one-to-many>
</attributes>
</entity>
<entity name="XMLJuniorScientist" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.JuniorScientist" access="PROPERTY">
</entity>
<entity name="XMLScientist" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.Scientist" access="PROPERTY">
<table name="CMP3_XML_SCIENTIST"/>
<id-class class="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.ScientistPK"/>
<sequence-generator name="XML_SCIENTIST_SEQUENCE_GENERATOR" sequence-name="SCIENTIST_SEQ" allocation-size="1"/>
<table-generator name="TBL_GEN" table="NAME_TBL"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<id name="idNumber" >
<column name="ID_NUMBER"/>
<generated-value strategy="SEQUENCE" generator="XML_SCIENTIST_SEQUENCE_GENERATOR"/>
</id>
<id name="firstName" >
<column name="F_NAME"/>
</id>
<id name="lastName" >
<column name="L_NAME"/>
</id>
<many-to-one name="department" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.Department">
<join-column name="DEPT_NAME" referenced-column-name="NAME"/>
<join-column name="DEPT_ROLE" referenced-column-name="DEPT_ROLE"/>
<join-column name="DEPT_LOCATION" referenced-column-name="LOCATION"/>
</many-to-one>
<one-to-one name="cubicle" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.Cubicle">
<join-column name="CUBE_ID" referenced-column-name="ID"/>
<join-column name="CUBE_CODE" referenced-column-name="CODE"/>
</one-to-one>
</attributes>
</entity>
<entity name="XMLAdministrator" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.derivedid.Administrator" access="PROPERTY">
<table name="CMP3_XML_ADMIN"/>
<secondary-table name="CMP3_XML_ADMIN_CONTRACT"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<basic name="contractCompany">
<column name="CONTRACT_COMPANY"/>
</basic>
<basic name="endDate">
<column name="END_DATE" table="CMP3_XML_ADMIN_CONTRACT"/>
</basic>
<version name="version"/>
<one-to-one name="employee" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.Employee" id="true"/>
</attributes>
</entity>
<entity name="XMLDepartmentAdminRole" class="org.eclipse.persistence.testing.models.jpa.xml.advanced.derivedid.DepartmentAdminRole" access="PROPERTY">
<table name="CMP3_XML_DEPT_ADMIN"/>
<id-class class="org.eclipse.persistence.testing.models.jpa.xml.advanced.derivedid.DepartmentAdminRolePK"/>
<exclude-default-listeners/>
<exclude-superclass-listeners/>
<attributes>
<one-to-one name="department" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.compositepk.Department" id="true">
<join-column name="DEPT_NAME" referenced-column-name="NAME"/>
<join-column name="DEPT_ROLE" referenced-column-name="DEPT_ROLE"/>
<join-column name="DEPT_LOCATION" referenced-column-name="LOCATION"/>
</one-to-one>
<one-to-one name="admin" target-entity="org.eclipse.persistence.testing.models.jpa.xml.advanced.derivedid.Administrator" id="true"/>
</attributes>
</entity>
<embeddable class="org.eclipse.persistence.testing.models.jpa.xml.advanced.EmploymentPeriod" access="PROPERTY">
<attributes>
<basic name="startDate">
<column name="S_DATE"/>
<temporal>DATE</temporal>
</basic>
<basic name="endDate">
<column name="E_DATE"/>
<temporal>DATE</temporal>
</basic>
</attributes>
</embeddable>
</entity-mappings>