db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r441641 [2/2] - in /db/jdo/trunk/tck20/src: java/org/apache/jdo/tck/mapping/ java/org/apache/jdo/tck/pc/companyMapWithoutJoin/ jdo/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/ jdo/datastoreidentity/org/apache/jdo/tck/pc/...
Date Fri, 08 Sep 2006 20:37:09 GMT
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/PartTimeEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/PartTimeEmployee.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/PartTimeEmployee.java
(added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/PartTimeEmployee.java
Fri Sep  8 13:37:08 2006
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.companyMapWithoutJoin;
+
+import java.util.Date;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a part-time employee.
+ */
+public class PartTimeEmployee extends Employee implements IPartTimeEmployee {
+    private double wage;
+
+    /** This is the JDO-required no-args constructor. The TCK relies on
+     * this constructor for testing PersistenceManager.newInstance(PCClass).
+     */
+    public PartTimeEmployee() {}
+
+    /**
+     * Construct a part-time employee.
+     * @param personid The identifier for the person.
+     * @param first The person's first name.
+     * @param last The person's last name.
+     * @param middle The person's middle name.
+     * @param born The person's birthdate.
+     * @param hired The date the person was hired.
+     * @param wage The person's wage.
+     */
+    public PartTimeEmployee(long personid, String first, String last,
+                            String middle, Date born,
+                            Date hired, String role, double wage ) {
+        super(personid, first, last, middle, born, hired, role);
+        this.wage = wage;
+    }
+
+    /**
+     * Get the wage of the part-time employee.
+     * @return The wage of the part-time employee.
+     */
+    public double getWage() {
+        return wage;
+    }
+
+    /**
+     * Set the wage of the part-time employee.
+     * @param wage The wage of the part-time employee.
+     */
+    public void setWage(double wage) {
+        this.wage = wage;
+    }
+
+    /**
+     * Returns a String representation of a <code>PartTimeEmployee</code> object.
+     * @return a String representation of a <code>PartTimeEmployee</code> object.
+     */
+    public String toString() {
+        return "PartTimeEmployee(" + getFieldRepr() + ")";
+    }
+
+    /**
+     * Returns a String representation of the non-relationship fields.
+     * @return a String representation of the non-relationship fields.
+     */
+    public String getFieldRepr() {
+        StringBuffer rc = new StringBuffer();
+        rc.append(super.getFieldRepr());
+        rc.append(", $" + wage);
+        return rc.toString();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified
+     * PartTimeEmployee. 
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(Object other, 
+                                        EqualityHelper helper) {
+        IPartTimeEmployee otherEmp = (IPartTimeEmployee)other;
+        String where = "PartTimeEmployee<" + getPersonid() + ">";
+        return super.deepCompareFields(otherEmp, helper) &
+            helper.closeEnough(wage, otherEmp.getWage(), where + ".wage");
+    }
+}

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Person.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Person.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Person.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Person.java Fri
Sep  8 13:37:08 2006
@@ -0,0 +1,329 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+
+package org.apache.jdo.tck.pc.companyMapWithoutJoin;
+
+import java.io.Serializable;
+
+import java.text.SimpleDateFormat;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a person.
+ */
+public class Person 
+    implements IPerson, Serializable, Comparable, Comparator, DeepEquality  {
+
+    private long    personid;
+    private String  firstname;
+    private String  lastname;
+    private String  middlename;
+    private Date    birthdate;
+
+    protected static SimpleDateFormat formatter =
+        new SimpleDateFormat("d/MMM/yyyy");
+
+    /** This is the JDO-required no-args constructor. */
+    protected Person() {}
+
+    /**
+     * Construct a <code>Person</code> instance.
+     * @param personid The person identifier.
+     * @param firstname The person's first name.
+     * @param lastname The person's last name.
+     * @param middlename The person's middle name.
+     * @param birthdate The person's birthdate.
+     */
+    public Person(long personid, String firstname, String lastname, 
+                  String middlename, Date birthdate) {
+        this.personid = personid;
+        this.firstname = firstname;
+        this.lastname = lastname;
+        this.middlename = middlename;
+        this.birthdate = birthdate;
+    }
+
+    /**
+     * Set the id associated with this object.
+     * @param id the id.
+     */
+    public void setPersonid(long id) {
+        if (this.personid != 0)
+            throw new IllegalStateException("Id is already set.");
+        this.personid = id;
+    }
+
+    /**
+     * Get the person's id.
+     * @return The personid.
+     */
+    public long getPersonid() {
+        return personid;
+    }
+
+    /**
+     * Set the person's id.
+     * @param personid The personid.
+     */
+    public void setLastname(long personid) {
+        this.personid = personid;
+    }
+
+    /**
+     * Get the person's last name.
+     * @return The last name.
+     */
+    public String getLastname() {
+        return lastname;
+    }
+
+    /**
+     * Set the person's last name.
+     * @param lastname The last name.
+     */
+    public void setLastname(String lastname) {
+        this.lastname = lastname;
+    }
+
+    /**
+     * Get the person's first name.
+     * @return The first name.
+     */
+    public String getFirstname() {
+        return firstname;
+    }
+
+    /**
+     * Set the person's first name.
+     * @param firstname The first name.
+     */
+    public void setFirstname(String firstname) {
+        this.firstname = firstname;
+    }
+
+    /**
+     * Get the person's middle name.
+     * @return The middle name.
+     */
+    public String getMiddlename() {
+        return middlename;
+    }
+
+    /**
+     * Set the person's middle name.
+     * @param middlename The middle name.
+     */
+    public void setMiddlename(String middlename) {
+        this.middlename = middlename;
+    }
+
+    /**
+     * Get the person's birthdate.
+     * @return The person's birthdate.
+     */
+    public Date getBirthdate() {
+        return birthdate;
+    }
+
+    /**
+     * Set the person's birthdate.
+     * @param birthdate The person's birthdate.
+     */
+    public void setBirthdate(Date birthdate) {
+        this. birthdate = birthdate;
+    }
+
+    /**
+     * Returns a String representation of a <code>Person</code> object.
+     * @return a string representation of a <code>Person</code> object.
+     */
+    public String toString() {
+        return "Person(" + getFieldRepr() + ")";
+    }
+    
+    /**
+     * Returns a String representation of the non-relationship fields.
+     * @return a String representation of the non-relationship fields.
+     */
+    protected String getFieldRepr() {
+        StringBuffer rc = new StringBuffer();
+        rc.append(personid);
+        rc.append(", ").append(lastname);
+        rc.append(", ").append(firstname);
+        rc.append(", born ").append(formatter.format(birthdate));
+        return rc.toString();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified Person.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(Object other, 
+                                     EqualityHelper helper) {
+        IPerson otherPerson = (IPerson)other;
+        String where = "Person<" + personid + ">";
+        return 
+            helper.equals(personid, otherPerson.getPersonid(), where + ".personid") &
+            helper.equals(firstname, otherPerson.getFirstname(), where + ".firstname") &
+            helper.equals(lastname, otherPerson.getLastname(), where + ".lastname") &
+            helper.equals(middlename, otherPerson.getMiddlename(), where + ".middlename")
&
+            helper.equals(birthdate, otherPerson.getBirthdate(), where + ".birthdate") ;
+    }
+
+    /** 
+     * Compares this object with the specified object for order. Returns a
+     * negative integer, zero, or a positive integer as this object is less
+     * than, equal to, or greater than the specified object. 
+     * @param o The Object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this 
+     * object is less than, equal to, or greater than the specified object. 
+     * @throws ClassCastException - if the specified object's type prevents
+     * it from being compared to this Object. 
+     */
+    public int compareTo(Object o) {
+        return compareTo((IPerson)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((IPerson)o1, (IPerson)o2);
+    }
+
+    /** 
+     * Compares this object with the specified Person object for
+     * order. Returns a negative integer, zero, or a positive integer as
+     * this object is less than, equal to, or greater than the specified
+     * object.  
+     * @param other The Person object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this
+     * object is less than, equal to, or greater than the specified Person 
+     * object. 
+     */
+    public int compareTo(IPerson other) {
+        return compare(this, other);
+    }
+
+    /**
+     * Compares its two IPerson arguments for order. Returns a negative
+     * integer, zero, or a positive integer as the first argument is less
+     * than, equal to, or greater than the second. 
+     * @param o1 the first IPerson object to be compared. 
+     * @param o2 the second IPerson object to be compared. 
+     * @return a negative integer, zero, or a positive integer as the first
+     * object is less than, equal to, or greater than the second object. 
+     */
+    public static int compare(IPerson o1, IPerson o2) {
+        return EqualityHelper.compare(o1.getPersonid(), o2.getPersonid());
+    }
+    
+    /** 
+     * Indicates whether some other object is "equal to" this one.
+     * @param obj the object with which to compare.
+     * @return <code>true</code> if this object is the same as the obj
+     * argument; <code>false</code> otherwise. 
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof IPerson) {
+            return compareTo((IPerson)obj) == 0;
+        }
+        return false;
+    }
+        
+    /**
+     * Returns a hash code value for the object. 
+     * @return a hash code value for this object.
+     */
+    public int hashCode() {
+        return (int)personid;
+    }
+    /**
+     * This class is used to represent the application identifier
+     * for the <code>Person</code> class.
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This field represents the identifier for the <code>Person</code>
+         * class. It must match a field in the <code>Person</code> class in
+         * both name and type. 
+         */
+        public long personid;
+
+        /**
+         * The required public no-arg constructor.
+         */
+        public Oid() { }
+
+        /**
+         * Initialize the identifier.
+         * @param personid The person identifier.
+         */
+        public Oid(long personid) {
+            this.personid = personid;
+        }
+        
+        public Oid(String s) { personid = Long.parseLong(justTheId(s)); }
+
+        public String toString() { return this.getClass().getName() + ": "  + personid;}
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null ||
+                !this.getClass().equals(obj.getClass()) ) return( false );
+            Oid o = (Oid) obj;
+            if( this.personid != o.personid ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) personid );
+        }
+        
+        protected static String justTheId(String str) {
+            return str.substring(str.indexOf(':') + 1);
+        }
+
+        /** */
+        public int compareTo(Object obj) {
+            // may throw ClassCastException which the user must handle
+            Oid other = (Oid) obj;
+            if( personid < other.personid ) return -1;
+            if( personid > other.personid ) return 1;
+            return 0;
+        }
+
+    }
+
+}

Added: db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo
(added)
+++ db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo
Fri Sep  8 13:37:08 2006
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<jdo xmlns="http://java.sun.com/xml/ns/jdo/jdo"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdo 
+	http://java.sun.com/xml/ns/jdo/jdo_2_0.xsd">
+<!--
+This file contains the schema information when an implementation
+has application identity.
+-->
+    <package name="org.apache.jdo.tck.pc.companyMapWithoutJoin">
+
+        <class name="Company"
+            identity-type="application"
+            objectid-class="org.apache.jdo.tck.pc.companyMapWithoutJoin.Company$Oid">
+            <field name="companyid" primary-key="true"/>
+            <field name="departments" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Department"/>
+            </field>
+        </class>
+
+        <class name="Department"
+            identity-type="application"
+            objectid-class="org.apache.jdo.tck.pc.companyMapWithoutJoin.Department$Oid">
+            <field name="deptid" primary-key="true"/>
+            <field name="roles" persistence-modifier="persistent">
+                <map key-type="String"
+                    value-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+            </field>
+        </class>
+
+        <class name="Employee"
+            identity-type="application"
+            persistence-capable-superclass="org.apache.jdo.tck.pc.companyMapWithoutJoin.Person">
+            <field name="team" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+            </field>
+            <field name="hradvisees" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+            </field>
+        </class>
+
+        <class name="FullTimeEmployee"
+            identity-type="application"
+            persistence-capable-superclass="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+
+        <class name="PartTimeEmployee"
+            identity-type="application"
+            persistence-capable-superclass="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+
+        <class name="Person"
+            identity-type="application"
+            objectid-class="org.apache.jdo.tck.pc.companyMapWithoutJoin.Person$Oid">
+            <field name="personid" primary-key="true"/>
+            <field name="middlename" default-fetch-group="false"/>
+        </class>
+
+        <interface name="ICompany"
+            identity-type="application">
+            <property name="companyid" primary-key="true"/>
+            <property name="departments" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.IDepartment"/>
+            </property>
+        </interface>
+
+        <interface name="IDepartment"
+            identity-type="application">
+            <property name="deptid" primary-key="true"/>
+            <property name="roles" persistence-modifier="persistent">
+                <map key-type="String"
+                    value-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+            </property>
+        </interface>
+
+        <interface name="IEmployee"
+            identity-type="application">
+            <property name="team" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.IEmployee"/>
+            </property>
+            <property name="hradvisees" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.IEmployee"/>
+            </property>
+        </interface>
+
+        <interface name="IFullTimeEmployee"
+            identity-type="application"/>
+
+        <interface name="IPartTimeEmployee"
+            identity-type="application"/>
+
+        <interface name="IPerson"
+            identity-type="application">
+            <property name="personid" primary-key="true"/>
+            <property name="middlename" default-fetch-group="false"/>
+        </interface>
+
+    </package>
+</jdo>

Added: db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo
(added)
+++ db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo
Fri Sep  8 13:37:08 2006
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<jdo xmlns="http://java.sun.com/xml/ns/jdo/jdo"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdo 
+	http://java.sun.com/xml/ns/jdo/jdo_2_0.xsd">
+<!--
+This file contains the schema information when an implementation
+has datastore identity.
+-->
+    <package name="org.apache.jdo.tck.pc.companyMapWithoutJoin">
+
+        <class name="Company"
+            identity-type="datastore"
+            objectid-class="org.apache.jdo.tck.pc.companyMapWithoutJoin.Company$Oid">
+            <field name="departments" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Department"/>
+            </field>
+        </class>
+
+        <class name="Department"
+            identity-type="datastore"
+            objectid-class="org.apache.jdo.tck.pc.companyMapWithoutJoin.Department$Oid">
+            <field name="roles" persistence-modifier="persistent">
+                <map key-type="String"
+                    value-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+            </field>
+        </class>
+
+        <class name="Employee"
+            identity-type="datastore"
+            persistence-capable-superclass="org.apache.jdo.tck.pc.companyMapWithoutJoin.Person">
+            <field name="team" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+            </field>
+            <field name="hradvisees" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+            </field>
+        </class>
+
+        <class name="FullTimeEmployee"
+            identity-type="datastore"
+            persistence-capable-superclass="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+
+        <class name="PartTimeEmployee"
+            identity-type="datastore"
+            persistence-capable-superclass="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+
+        <class name="Person"
+            identity-type="datastore"
+            objectid-class="org.apache.jdo.tck.pc.companyMapWithoutJoin.Person$Oid">
+            <field name="middlename" default-fetch-group="false"/>
+        </class>
+
+        <interface name="ICompany"
+            identity-type="datastore">
+            <property name="departments" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.IDepartment"/>
+            </property>
+        </interface>
+
+        <interface name="IDepartment"
+            identity-type="datastore">
+            <property name="roles" persistence-modifier="persistent">
+                <map key-type="String"
+                    value-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.Employee"/>
+            </property>
+        </interface>
+
+        <interface name="IEmployee"
+            identity-type="datastore">
+            <property name="team" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.IEmployee"/>
+            </property>
+            <property name="hradvisees" persistence-modifier="persistent">
+                <collection element-type="org.apache.jdo.tck.pc.companyMapWithoutJoin.IEmployee"/>
+            </property>
+        </interface>
+
+        <interface name="IFullTimeEmployee"
+            identity-type="datastore"/>
+
+        <interface name="IPartTimeEmployee"
+            identity-type="datastore"/>
+
+        <interface name="IPerson"
+            identity-type="datastore">
+            <property name="middlename" default-fetch-group="false"/>
+        </interface>
+
+    </package>
+</jdo>

Added: db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm
(added)
+++ db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm
Fri Sep  8 13:37:08 2006
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<orm xmlns="http://java.sun.com/xml/ns/jdo/orm"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/orm 
+	http://java.sun.com/xml/ns/jdo/orm_2_0.xsd">
+<!--
+This file contains the schema information when an implementation
+has application identity.
+-->
+    <package name="org.apache.jdo.tck.pc.companyMapWithoutJoin">
+
+        <class name="Company" table="companies">
+            <field name="companyid" column="ID"/>
+            <field name="name" column="NAME">
+              <column name="NAME" sql-type="VARCHAR"/>
+            </field>
+            <field name="founded" column="FOUNDEDDATE"/>
+            <field name="departments" mapped-by="company"/>
+        </class>
+
+        <class name="Department" table="departments">
+            <field name="deptid" column="ID"/>
+            <field name="name" column="NAME"/>
+            <field name="company" column="COMPANYID"/>
+            <!-- field type is Map<String, Employee> -->
+            <field name="roles" mapped-by="department">
+                <key mapped-by="role"/>
+            </field>
+        </class>
+
+        <class name="PartTimeEmployee">
+            <inheritance strategy="superclass-table"/>
+            <field name="wage" column="WAGE"/>
+        </class>
+
+        <class name="FullTimeEmployee">
+            <inheritance strategy="superclass-table"/>
+            <field name="salary" column="SALARY"/>
+        </class>
+
+        <class name="Employee">
+            <inheritance strategy="superclass-table"/>
+            <field name="hiredate" column="HIREDATE"/>
+            <field name="weeklyhours" column="WEEKLYHOURS"/>
+            <field name="department" column="DEPARTMENT">
+                        <foreign-key/>
+            </field>
+            <field name="fundingDept" column="FUNDINGDEPT">
+                        <foreign-key/>
+            </field>
+            <field name="manager" column="MANAGER">
+                        <foreign-key/>
+            </field>
+            <field name="mentor" column="MENTOR">
+                        <foreign-key/>
+            </field>
+            <field name="protege" mapped-by="mentor"/>
+            <field name="hradvisor" column="HRADVISOR">
+                        <foreign-key/>
+            </field>
+            <field name="team" mapped-by="manager"/>
+            <field name="hradvisees" mapped-by="hradvisor"/>
+        </class>
+
+        <class name="Person" table="persons">
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"
+                    indexed="true"/>
+            </inheritance>
+            <field name="personid" column="PERSONID"/>
+            <field name="firstname" column="FIRSTNAME"/>
+            <field name="lastname" column="LASTNAME"/>
+            <field name="middlename">
+              <column name="MIDDLENAME" allows-null="true"/>
+            </field>
+            <field name="birthdate" column="BIRTHDATE"/>
+        </class>
+
+        <interface name="ICompany" table="companies">
+            <property name="companyid" column="ID"/>
+            <property name="name" column="NAME">
+              <column name="NAME" sql-type="VARCHAR"/>
+            </property>
+            <property name="founded" column="FOUNDEDDATE"/>
+            <property name="departments" mapped-by="company"/>
+        </interface>
+
+        <interface name="IDepartment" table="departments">
+            <!-- field type is Map<String, Employee> -->
+            <property name="roles" mapped-by="dept">
+                <key mapped-by="role"/>
+            </property>
+            <property name="deptid" column="ID"/>
+            <property name="name" column="NAME"/>
+            <property name="company" column="COMPANYID"/>
+        </interface>
+
+        <interface name="IPartTimeEmployee">
+            <inheritance strategy="superclass-table"/>
+            <property name="wage" column="WAGE"/>
+        </interface>
+
+        <interface name="IFullTimeEmployee">
+            <inheritance strategy="superclass-table"/>
+            <property name="salary" column="SALARY"/>
+        </interface>
+
+        <interface name="IEmployee">
+            <inheritance strategy="superclass-table"/>
+            <property name="hiredate" column="HIREDATE"/>
+            <property name="weeklyhours" column="WEEKLYHOURS"/>
+            <property name="department" column="DEPARTMENT">
+                        <foreign-key/>
+            </property>
+            <property name="fundingDept" column="FUNDINGDEPT">
+                        <foreign-key/>
+            </property>
+            <property name="manager" column="MANAGER">
+                        <foreign-key/>
+            </property>
+            <property name="mentor" column="MENTOR">
+                        <foreign-key/>
+            </property>
+            <property name="protege" mapped-by="mentor"/>
+            <property name="hradvisor" column="HRADVISOR">
+                        <foreign-key/>
+            </property>
+            <property name="team" mapped-by="manager"/>
+            <property name="hradvisees" mapped-by="hradvisor"/>
+        </interface>
+
+        <interface name="IPerson" table="persons">
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"
+                    indexed="true"/>
+            </inheritance>
+            <property name="personid" column="PERSONID"/>
+            <property name="firstname" column="FIRSTNAME"/>
+            <property name="lastname" column="LASTNAME"/>
+            <property name="middlename">
+              <column name="MIDDLENAME" allows-null="true"/>
+            </property>
+        </interface>
+    </package>
+</orm>

Added: db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm
(added)
+++ db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm
Fri Sep  8 13:37:08 2006
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<orm xmlns="http://java.sun.com/xml/ns/jdo/orm"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/orm 
+	http://java.sun.com/xml/ns/jdo/orm_2_0.xsd">
+<!--
+This file contains the schema information when an implementation
+has application identity.
+-->
+    <package name="org.apache.jdo.tck.pc.companyMapWithoutJoin">
+
+        <class name="Company" table="companies">
+            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+
+            <field name="companyid" column="ID"/>
+            <field name="name" column="NAME">
+              <column name="NAME" sql-type="VARCHAR"/>
+            </field>
+            <field name="founded" column="FOUNDEDDATE"/>
+            <field name="departments" mapped-by="company"/>
+        </class>
+
+        <class name="Department" table="departments">
+            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <field name="deptid" column="ID"/>
+            <field name="name" column="NAME"/>
+            <field name="company" column="COMPANYID"/>
+            <!-- field type is Map<String, Employee> -->
+            <field name="roles" mapped-by="department">
+                <key mapped-by="role"/>
+            </field>
+        </class>
+
+        <class name="PartTimeEmployee">
+            <inheritance strategy="superclass-table"/>
+            <field name="wage" column="WAGE"/>
+        </class>
+
+        <class name="FullTimeEmployee">
+            <inheritance strategy="superclass-table"/>
+            <field name="salary" column="SALARY"/>
+        </class>
+
+        <class name="Employee">
+            <inheritance strategy="superclass-table"/>
+            <field name="hiredate" column="HIREDATE"/>
+            <field name="weeklyhours" column="WEEKLYHOURS"/>
+            <field name="department" column="DEPARTMENT">
+                        <foreign-key/>
+            </field>
+            <field name="fundingDept" column="FUNDINGDEPT">
+                        <foreign-key/>
+            </field>
+            <field name="manager" column="MANAGER">
+                        <foreign-key/>
+            </field>
+            <field name="mentor" column="MENTOR">
+                        <foreign-key/>
+            </field>
+            <field name="protege" mapped-by="mentor"/>
+            <field name="hradvisor" column="HRADVISOR">
+                        <foreign-key/>
+            </field>
+            <field name="team" mapped-by="manager"/>
+            <field name="hradvisees" mapped-by="hradvisor"/>
+        </class>
+
+        <class name="Person" table="persons">
+            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"
+                    indexed="true"/>
+            </inheritance>
+            <field name="personid" column="PERSONID"/>
+            <field name="firstname" column="FIRSTNAME"/>
+            <field name="lastname" column="LASTNAME"/>
+            <field name="middlename">
+              <column name="MIDDLENAME" allows-null="true"/>
+            </field>
+            <field name="birthdate" column="BIRTHDATE"/>
+        </class>
+
+        <interface name="ICompany" table="companies">
+            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <property name="companyid" column="ID"/>
+            <property name="name" column="NAME">
+              <column name="NAME" sql-type="VARCHAR"/>
+            </property>
+            <property name="founded" column="FOUNDEDDATE"/>
+            <property name="departments" mapped-by="company"/>
+        </interface>
+
+        <interface name="IDepartment" table="departments">
+            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <!-- field type is Map<String, Employee> -->
+            <property name="roles" mapped-by="dept">
+                <key mapped-by="role"/>
+            </property>
+            <property name="deptid" column="ID"/>
+            <property name="name" column="NAME"/>
+            <property name="company" column="COMPANYID"/>
+        </interface>
+
+        <interface name="IPartTimeEmployee">
+            <inheritance strategy="superclass-table"/>
+            <property name="wage" column="WAGE"/>
+        </interface>
+
+        <interface name="IFullTimeEmployee">
+            <inheritance strategy="superclass-table"/>
+            <property name="salary" column="SALARY"/>
+        </interface>
+
+        <interface name="IEmployee">
+            <inheritance strategy="superclass-table"/>
+            <property name="hiredate" column="HIREDATE"/>
+            <property name="weeklyhours" column="WEEKLYHOURS"/>
+            <property name="department" column="DEPARTMENT">
+                        <foreign-key/>
+            </property>
+            <property name="fundingDept" column="FUNDINGDEPT">
+                        <foreign-key/>
+            </property>
+            <property name="manager" column="MANAGER">
+                        <foreign-key/>
+            </property>
+            <property name="mentor" column="MENTOR">
+                        <foreign-key/>
+            </property>
+            <property name="protege" mapped-by="mentor"/>
+            <property name="hradvisor" column="HRADVISOR">
+                        <foreign-key/>
+            </property>
+            <property name="team" mapped-by="manager"/>
+            <property name="hradvisees" mapped-by="hradvisor"/>
+        </interface>
+
+        <interface name="IPerson" table="persons">
+            <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"
+                    indexed="true"/>
+            </inheritance>
+            <property name="personid" column="PERSONID"/>
+            <property name="firstname" column="FIRSTNAME"/>
+            <property name="lastname" column="LASTNAME"/>
+            <property name="middlename">
+              <column name="MIDDLENAME" allows-null="true"/>
+            </property>
+        </interface>
+    </package>
+</orm>

Added: db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema9.sql
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema9.sql?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema9.sql (added)
+++ db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema9.sql Fri Sep  8 13:37:08 2006
@@ -0,0 +1,69 @@
+-- SchemaType: application identity
+
+connect 'jdbc:derby:jdotckdb;create=true' user 'tckuser' password 'tckuser';
+
+CREATE SCHEMA applicationidentity9;
+SET SCHEMA applicationidentity9;
+
+-------------------------
+-- company
+-------------------------
+
+ALTER TABLE departments DROP CONSTRAINT EMP_MO_FK;
+ALTER TABLE departments DROP CONSTRAINT DEPTS_COMP_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_DEPT_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_FUNDDEPT_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_MANAGER_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_MENTOR_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_HRADVISOR_FK;
+DROP TABLE persons;
+DROP TABLE departments;
+DROP TABLE companies;
+
+CREATE TABLE companies (
+    ID INTEGER NOT NULL,
+    NAME VARCHAR(32) NOT NULL,
+    FOUNDEDDATE VARCHAR(32) NOT NULL,
+    CONSTRAINT COMPS_PK PRIMARY KEY (ID)
+);
+
+CREATE TABLE departments (
+    ID INTEGER NOT NULL,
+    NAME VARCHAR(32) NOT NULL,
+    EMP_OF_THE_MONTH INTEGER,
+    COMPANYID INTEGER,
+    DISCRIMINATOR VARCHAR(255),
+    CONSTRAINT DEPTS_COMP_FK FOREIGN KEY (COMPANYID) REFERENCES companies,
+    CONSTRAINT DEPTS_PK PRIMARY KEY (ID)
+);
+
+CREATE TABLE persons (
+    PERSONID INTEGER NOT NULL,
+    FIRSTNAME VARCHAR(32) NOT NULL,
+    LASTNAME VARCHAR(32) NOT NULL,
+    MIDDLENAME VARCHAR(32),
+    BIRTHDATE VARCHAR(32) NOT NULL,
+    DISCRIMINATOR varchar(64) NOT NULL,
+    EMPID INTEGER NOT NULL,
+    HIREDATE VARCHAR(32),
+    WEEKLYHOURS REAL,
+    DEPARTMENT INTEGER,
+    FUNDINGDEPT INTEGER,
+    MANAGER INTEGER,
+    MENTOR INTEGER,
+    HRADVISOR INTEGER,
+    SALARY REAL,
+    WAGE REAL,
+    CONSTRAINT PERS_DEPT_FK FOREIGN KEY (DEPARTMENT) REFERENCES departments,
+    CONSTRAINT PERS_FUNDDEPT_FK FOREIGN KEY (FUNDINGDEPT)
+        REFERENCES departments,
+    CONSTRAINT PERS_MANAGER_FK FOREIGN KEY (MANAGER) REFERENCES persons,
+    CONSTRAINT PERS_MENTOR_FK FOREIGN KEY (MENTOR) REFERENCES persons,
+    CONSTRAINT PERS_HRADVISOR_FK FOREIGN KEY (HRADVISOR) REFERENCES persons,
+    CONSTRAINT PERS_PK PRIMARY KEY (PERSONID)
+);
+
+ALTER TABLE departments 
+    ADD CONSTRAINT EMP_MO_FK FOREIGN KEY
+        (EMP_OF_THE_MONTH) REFERENCES persons(PERSONID);
+

Added: db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema9.sql
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema9.sql?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema9.sql (added)
+++ db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema9.sql Fri Sep  8 13:37:08 2006
@@ -0,0 +1,72 @@
+-- SchemaType: datastore identity
+
+connect 'jdbc:derby:jdotckdb;create=true' user 'tckuser' password 'tckuser';
+
+CREATE SCHEMA datastoreidentity9;
+SET SCHEMA datastoreidentity9;
+
+-------------------------
+-- company
+-------------------------
+
+ALTER TABLE departments DROP CONSTRAINT EMP_MO_FK;
+ALTER TABLE departments DROP CONSTRAINT DEPTS_COMP_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_DEPT_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_FUNDDEPT_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_MANAGER_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_MENTOR_FK;
+ALTER TABLE persons DROP CONSTRAINT PERS_HRADVISOR_FK;
+DROP TABLE persons;
+DROP TABLE departments;
+DROP TABLE companies;
+
+CREATE TABLE companies (
+    DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+    ID INTEGER NOT NULL,
+    NAME VARCHAR(32) NOT NULL,
+    FOUNDEDDATE VARCHAR(32) NOT NULL,
+    CONSTRAINT COMPS_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
+CREATE TABLE departments (
+    DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+    ID INTEGER NOT NULL,
+    NAME VARCHAR(32) NOT NULL,
+    EMP_OF_THE_MONTH INTEGER,
+    COMPANYID INTEGER,
+    DISCRIMINATOR VARCHAR(255),
+    CONSTRAINT DEPTS_COMP_FK FOREIGN KEY (COMPANYID) REFERENCES companies,
+    CONSTRAINT DEPTS_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
+CREATE TABLE persons (
+    DATASTORE_IDENTITY INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
+    PERSONID INTEGER NOT NULL,
+    FIRSTNAME VARCHAR(32) NOT NULL,
+    LASTNAME VARCHAR(32) NOT NULL,
+    MIDDLENAME VARCHAR(32),
+    BIRTHDATE VARCHAR(32) NOT NULL,
+    DISCRIMINATOR varchar(64) NOT NULL,
+    EMPID INTEGER NOT NULL,
+    HIREDATE VARCHAR(32),
+    WEEKLYHOURS REAL,
+    DEPARTMENT INTEGER,
+    FUNDINGDEPT INTEGER,
+    MANAGER INTEGER,
+    MENTOR INTEGER,
+    HRADVISOR INTEGER,
+    SALARY REAL,
+    WAGE REAL,
+    CONSTRAINT PERS_DEPT_FK FOREIGN KEY (DEPARTMENT) REFERENCES departments,
+    CONSTRAINT PERS_FUNDDEPT_FK FOREIGN KEY (FUNDINGDEPT)
+        REFERENCES departments,
+    CONSTRAINT PERS_MANAGER_FK FOREIGN KEY (MANAGER) REFERENCES persons,
+    CONSTRAINT PERS_MENTOR_FK FOREIGN KEY (MENTOR) REFERENCES persons,
+    CONSTRAINT PERS_HRADVISOR_FK FOREIGN KEY (HRADVISOR) REFERENCES persons,
+    CONSTRAINT PERS_PK PRIMARY KEY (DATASTORE_IDENTITY)
+);
+
+ALTER TABLE departments 
+    ADD CONSTRAINT EMP_MO_FK FOREIGN KEY
+        (EMP_OF_THE_MONTH) REFERENCES persons(PERSONID);
+



Mime
View raw message