You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by mp...@apache.org on 2007/02/09 04:49:24 UTC
svn commit: r505160 [1/3] - in
/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence:
models/ models/abstract-super/ models/basic/ models/fetchlazy/
models/idclass/ models/joined/ models/propertyaccess/ models/s...
Author: mprudhom
Date: Thu Feb 8 19:49:22 2007
New Revision: 505160
URL: http://svn.apache.org/viewvc?view=rev&rev=505160
Log:
Added multiple different implementations of the same data model for flexibility testing; added a helper test case from which other tests can be extended to easily perform persistence operations
Added:
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/CompanyModelTest.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IAddress.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICompany.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICustomer.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IFullTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ILineItem.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPartTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPerson.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProduct.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProductOrder.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/abstract-super/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Address.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Company.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Customer.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Employee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/FullTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/LineItem.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/PartTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Person.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Product.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/ProductOrder.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/TestBasicCompanyModel.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Address.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Company.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Customer.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Employee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/FullTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/LineItem.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/PartTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Person.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Product.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/ProductOrder.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/TestLazyCompanyModel.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/Address.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/Company.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/Customer.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/Employee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/FullTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/LineItem.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/PartTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/Person.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/Product.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/ProductOrder.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/idclass/TestIdClassCompanyModel.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/Address.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/Company.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/Customer.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/Employee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/FullTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/LineItem.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/PartTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/Person.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/Product.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/ProductOrder.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/joined/TestJoinedCompanyModel.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/Address.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/Company.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/Customer.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/Employee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/FullTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/LineItem.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/PartTimeEmployee.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/Person.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/Product.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/ProductOrder.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/propertyaccess/TestPropertyCompanyModel.java (with props)
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/single-table/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/
incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/SingleEMTest.java (with props)
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/CompanyModelTest.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/CompanyModelTest.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/CompanyModelTest.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/CompanyModelTest.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+import java.beans.*;
+import java.io.*;
+import java.util.*;
+import javax.persistence.*;
+import junit.framework.*;
+import org.apache.openjpa.persistence.test.*;
+
+/**
+ * Generic test case that will be extended by a concrete company
+ * model subclass.
+ *
+ * @author Marc Prud'hommeaux
+ */
+public abstract class CompanyModelTest extends SingleEMTest {
+ private static Map<Class,Class> factoryClasses;
+
+ private final Map<Class,Class> impls;
+
+ public CompanyModelTest() {
+ // make a map of the implementations based on the class names in
+ // the current package of the test subclass
+ impls = new HashMap<Class,Class>();
+ impls.put(IAddress.class, localClass("Address"));
+ impls.put(ICompany.class, localClass("Company"));
+ impls.put(ICustomer.class, localClass("Customer"));
+ impls.put(IPerson.class, localClass("Person"));
+ impls.put(IEmployee.class, localClass("Employee"));
+ impls.put(IFullTimeEmployee.class, localClass("FullTimeEmployee"));
+ impls.put(ILineItem.class, localClass("LineItem"));
+ impls.put(IProductOrder.class, localClass("ProductOrder"));
+ impls.put(IPartTimeEmployee.class, localClass("PartTimeEmployee"));
+ impls.put(IProduct.class, localClass("Product"));
+
+ classes = (Class[]) impls.values().toArray(new Class[impls.size()]);
+ }
+
+ private Class localClass(String name) {
+ String pkg = getClass().getPackage().getName();
+ try {
+ return Class.forName(pkg + "." + name);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ try {
+ checkModel();
+ } catch (Exception e) {
+ closeEMF();
+ throw e;
+ }
+ }
+
+ /**
+ * Runs through basic queries against all of the properties of all
+ * of the known persistent classes. We're just checking here to
+ * make sure the queries can be executed without problem. Queries
+ * should always return all known instances in the database.
+ */
+ public void testBasicQueries() throws Exception {
+ for (Class c : impls.values()) {
+ for (PropertyDescriptor pd :
+ Introspector.getBeanInfo(c).getPropertyDescriptors()) {
+
+ if (pd.getWriteMethod() == null) // ignore read-only
+ continue;
+
+ Set<String> queries = new TreeSet<String>();
+ getBasicQueries(queries, pd, "x.");
+
+ StringBuilder str = new StringBuilder();
+
+ // execute the individual queries
+ for (String query : queries) {
+ find(c, "where " + query);
+ str.append(str.length() > 0 ? " or " : "").append(query);
+ }
+
+ // now execute all the queries combined
+ find(c, "where " + str);
+ }
+ }
+ }
+
+ void getBasicQueries(Set<String> queries, PropertyDescriptor pd,
+ String prefix) throws Exception {
+
+ // max level of field traversal: 3
+ // ### if (prefix.split("\\.").length > 3)
+ if (prefix.split("\\.").length > 2)
+ return;
+
+ Class type = pd.getPropertyType();
+
+ String name = prefix + pd.getName();
+
+ if (!queries.add(name + " is not null"))
+ return;
+
+ queries.add(name + " is null");
+
+ if (type.isAssignableFrom(Number.class) || type == int.class ||
+ type == double.class || type == float.class ||
+ type == long.class || type == short.class) {
+ queries.add(name + " = 0");
+ queries.add(name + " <> 0");
+ queries.add(name + " > 0");
+ queries.add(name + " < 0");
+ queries.add(name + " >= 0");
+ queries.add(name + " <= 0");
+ queries.add("sqrt(" + name + ") <> 0");
+ queries.add("abs(" + name + ") <> 0");
+ // queries.add("mod(" + name + ", 5) <> 0");
+ }
+
+ if (type.isAssignableFrom(Collection.class)) {
+ queries.add(name + " IS EMPTY");
+ queries.add(name + " IS NOT EMPTY");
+ queries.add("size(" + name + ") <> 0");
+ }
+
+ if (type.isAssignableFrom(String.class)) {
+ queries.add("lower(" + name + ") = 'x'");
+ queries.add("upper(" + name + ") = 'x'");
+ queries.add("concat(" + name + ", " + name + ") = 'x'");
+ queries.add("substring(" + name + ", 1, 2) = 'x'");
+ queries.add("length(" + name + ") > 0");
+ queries.add("locate(" + name + ", 'x', 1) > 0");
+ queries.add("trim(leading ' ' from " + name + ") = 'x'");
+ }
+
+ if (type.isAssignableFrom(Date.class)) {
+ queries.add(name + " <> CURRENT_TIMESTAMP");
+ }
+
+ // relation is an entity ... add all the relations
+ if (impls.containsKey(type) || impls.containsValue(type)) {
+ for (PropertyDescriptor desc :
+ Introspector.getBeanInfo(type).getPropertyDescriptors()) {
+
+ if (desc.getWriteMethod() == null) // ignore read-only
+ continue;
+
+ // prevent recursion
+ if (name.endsWith("." + desc.getName() + "."))
+ continue;
+
+ getBasicQueries(queries, desc, name + ".");
+ }
+ }
+ }
+
+ void checkModel() {
+ try {
+ verifyModel();
+ } catch (AssertionFailedError e) {
+ // clear all existing instances
+ delete(impls.values().toArray(new Class[0]));
+
+ // since the factory method needs to be static, we need to store
+ // the classes statically
+ factoryClasses = impls;
+ try {
+ Collection obs = (Collection) new XMLDecoder
+ (CompanyModelTest.class.
+ getResourceAsStream("companies.xml")).readObject();
+
+ assertNotNull(obs);
+
+ persist(obs.toArray());
+ } finally {
+ factoryClasses = null;
+ }
+ }
+
+ verifyModel();
+ }
+
+ int queryCount(Class c, String query, Object... params) {
+ return find(c, query, params).size();
+ }
+
+ int queryCount(Class c) {
+ return find(c, null).size();
+ }
+
+ Class impl(Class c) {
+ return impls.get(c);
+ }
+
+ void verifyModel() {
+ assertEquals(2, queryCount(impl(ICompany.class)));
+ assertEquals(11, queryCount(impl(IAddress.class)));
+ assertEquals(3, queryCount(impl(IProduct.class)));
+ assertEquals(2, queryCount(impl(IProductOrder.class)));
+ assertEquals(3, queryCount(impl(ILineItem.class)));
+ assertEquals(1, queryCount(impl(IPartTimeEmployee.class)));
+ assertEquals(3, queryCount(impl(IFullTimeEmployee.class)));
+ assertEquals(4, queryCount(impl(ICustomer.class)));
+
+ assertEquals(3, queryCount(impl(IAddress.class),
+ "where x.state = 'CA'"));
+
+ assertEquals(1, queryCount(impl(ICompany.class),
+ "where size(x.employees) = 4"));
+ assertEquals(1, queryCount(impl(ICompany.class),
+ "where size(x.employees) = 0"));
+
+ assertEquals(2, queryCount(impl(ICustomer.class),
+ "where size(x.orders) = 1"));
+
+ assertEquals(1, queryCount(impl(IProductOrder.class),
+ "where x.shippedDate is null"));
+ assertEquals(1, queryCount(impl(IProductOrder.class),
+ "where x.shippedDate is not null"));
+
+ assertEquals(1, queryCount(impl(IEmployee.class),
+ "where x.manager is null"));
+ assertEquals(2, queryCount(impl(IEmployee.class),
+ "where x.manager.manager is null"));
+ assertEquals(1, queryCount(impl(IEmployee.class),
+ "where x.manager.manager.manager is null"));
+
+ assertEquals(2, queryCount(impl(IPerson.class),
+ "where x.firstName like ?1 and x.lastName like ?1", "M%"));
+ assertEquals(1, queryCount(impl(IPerson.class),
+ "where x.homeAddress.state = 'CA'"));
+ }
+
+ /**
+ * Factory method that is called from the serialized XML.
+ */
+ public static Object create(Class intf)
+ throws InstantiationException, IllegalAccessException {
+ return factoryClasses.get(intf).newInstance();
+ }
+}
+
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/CompanyModelTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IAddress.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IAddress.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IAddress.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IAddress.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+public interface IAddress {
+
+ public void setStreetAddress(String streetAddress);
+ public String getStreetAddress();
+
+ public void setCity(String city);
+ public String getCity();
+
+ public void setState(String state);
+ public String getState();
+
+ public void setPostalCode(String postalCode);
+ public String getPostalCode();
+
+ public void setPhoneNumber(String phoneNumber);
+ public String getPhoneNumber();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IAddress.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICompany.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICompany.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICompany.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICompany.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+import java.util.*;
+
+public interface ICompany {
+
+ public void setName(String name);
+ public String getName();
+
+ public void setAddress(IAddress address);
+ public IAddress getAddress();
+
+ public void setEmployees(Set<? extends IEmployee> employees);
+ public Set<? extends IEmployee> getEmployees();
+
+ public void setProducts(Set<? extends IProduct> products);
+ public Set<? extends IProduct> getProducts();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICompany.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICustomer.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICustomer.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICustomer.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICustomer.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+import java.util.*;
+
+public interface ICustomer extends IPerson {
+
+ public void setOrders(Collection<? extends IProductOrder> orders);
+ public Collection<? extends IProductOrder> getOrders();
+
+ public void setShippingAddress(IAddress shippingAddress);
+ public IAddress getShippingAddress();
+
+ public void setBillingAddress(IAddress billingAddress);
+ public IAddress getBillingAddress();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ICustomer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IEmployee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IEmployee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IEmployee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IEmployee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+import java.util.*;
+
+public interface IEmployee extends IPerson {
+
+ public void setManager(IFullTimeEmployee manager);
+ public IFullTimeEmployee getManager();
+
+ public void setCompany(ICompany company);
+ public ICompany getCompany();
+
+ public void setTitle(String title);
+ public String getTitle();
+
+ public void setHireDate(Date hireDate);
+ public Date getHireDate();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IEmployee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IFullTimeEmployee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IFullTimeEmployee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IFullTimeEmployee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IFullTimeEmployee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+public interface IFullTimeEmployee extends IEmployee {
+
+ public void setSalary(float salary);
+ public float getSalary();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IFullTimeEmployee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ILineItem.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ILineItem.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ILineItem.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ILineItem.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+public interface ILineItem {
+
+ public void setQuantity(int quantity);
+ public int getQuantity();
+
+ public void setProduct(IProduct product);
+ public IProduct getProduct();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/ILineItem.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPartTimeEmployee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPartTimeEmployee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPartTimeEmployee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPartTimeEmployee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+public interface IPartTimeEmployee extends IEmployee {
+
+ public void setWage(float wage);
+ public float getWage();
+
+ public void setWeeklyHours(int weeklyHours);
+ public int getWeeklyHours();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPartTimeEmployee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPerson.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPerson.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPerson.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPerson.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+public interface IPerson {
+
+ public void setFirstName(String firstName);
+ public String getFirstName();
+
+ public void setLastName(String lastName);
+ public String getLastName();
+
+ public void setHomeAddress(IAddress homeAddress);
+ public IAddress getHomeAddress();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IPerson.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProduct.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProduct.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProduct.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProduct.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+import java.util.*;
+
+public interface IProduct {
+
+ public void setName(String name);
+ public String getName();
+
+ public void setImage(byte[] image);
+ public byte[] getImage();
+
+ public void setPrice(float price);
+ public float getPrice();
+
+ public void setDistributors(Set<? extends ICompany> distributors);
+ public Set<? extends ICompany> getDistributors();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProduct.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProductOrder.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProductOrder.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProductOrder.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProductOrder.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company;
+
+import java.util.*;
+
+public interface IProductOrder {
+
+ public void setItems(List<? extends ILineItem> items);
+ public List<? extends ILineItem> getItems();
+
+ public void setOrderDate(Date orderDate);
+ public Date getOrderDate();
+
+ public void setShippedDate(Date shippedDate);
+ public Date getShippedDate();
+
+ public void setCustomer(ICustomer customer);
+ public ICustomer getCustomer();
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/IProductOrder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Address.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Address.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Address.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Address.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_Address")
+@Table(name="BAS_Address") // OPENJPA-121
+public final class Address implements IAddress {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @Basic
+ private String streetAddress;
+
+ @Basic
+ private String city;
+
+ @Basic
+ private String state;
+
+ @Basic
+ private String postalCode;
+
+ @Basic
+ private String phoneNumber;
+
+ public void setStreetAddress(String streetAddress) {
+ this.streetAddress = streetAddress;
+ }
+
+ public String getStreetAddress() {
+ return this.streetAddress;
+ }
+
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getCity() {
+ return this.city;
+ }
+
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getState() {
+ return this.state;
+ }
+
+
+ public void setPostalCode(String postalCode) {
+ this.postalCode = postalCode;
+ }
+
+ public String getPostalCode() {
+ return this.postalCode;
+ }
+
+
+ public void setPhoneNumber(String phoneNumber) {
+ this.phoneNumber = phoneNumber;
+ }
+
+ public String getPhoneNumber() {
+ return this.phoneNumber;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Address.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Company.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Company.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Company.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Company.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import java.util.*;
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_Company")
+@Table(name="BAS_Company") // OPENJPA-121
+public final class Company implements ICompany {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @Basic
+ private String name;
+
+ @OneToOne
+ private Address address;
+
+ @OneToMany(mappedBy="company")
+ private Set<Employee> employees = new HashSet<Employee>();
+
+ @ManyToMany(mappedBy="distributors")
+ private Set<Product> products = new HashSet<Product>();
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+
+ public void setAddress(IAddress address) {
+ this.address = (Address) address;
+ }
+
+ public IAddress getAddress() {
+ return this.address;
+ }
+
+
+ public void setEmployees(Set<? extends IEmployee> employees) {
+ this.employees = (Set<Employee>) employees;
+ }
+
+ public Set<Employee> getEmployees() {
+ return this.employees;
+ }
+
+
+ public void setProducts(Set<? extends IProduct> products) {
+ this.products = (Set<Product>) products;
+ }
+
+ public Set<Product> getProducts() {
+ return this.products;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Company.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Customer.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Customer.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Customer.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Customer.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import java.util.*;
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_Customer")
+public final class Customer extends Person implements ICustomer {
+ @OneToMany(mappedBy="customer")
+ private Collection<ProductOrder> orders = new ArrayList<ProductOrder>();
+
+ @OneToOne
+ private Address shippingAddress;
+
+ @OneToOne
+ private Address billingAddress;
+
+ public void setOrders(Collection<? extends IProductOrder> orders) {
+ this.orders = (Collection<ProductOrder>) orders;
+ }
+
+ public Collection<ProductOrder> getOrders() {
+ return this.orders;
+ }
+
+
+ public void setShippingAddress(IAddress shippingAddress) {
+ this.shippingAddress = (Address) shippingAddress;
+ }
+
+ public IAddress getShippingAddress() {
+ return this.shippingAddress;
+ }
+
+
+ public void setBillingAddress(IAddress billingAddress) {
+ this.billingAddress = (Address) billingAddress;
+ }
+
+ public IAddress getBillingAddress() {
+ return this.billingAddress;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Customer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Employee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Employee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Employee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Employee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import java.util.*;
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_Employee")
+public abstract class Employee extends Person implements IEmployee {
+ @OneToOne
+ private FullTimeEmployee manager;
+
+ @OneToOne
+ private Company company;
+
+ @Basic
+ private String title;
+
+ @Basic
+ private Date hireDate;
+
+ public void setManager(IFullTimeEmployee manager) {
+ this.manager = (FullTimeEmployee) manager;
+ }
+
+ public IFullTimeEmployee getManager() {
+ return this.manager;
+ }
+
+
+ public void setCompany(ICompany company) {
+ this.company = (Company) company;
+ }
+
+ public ICompany getCompany() {
+ return this.company;
+ }
+
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getTitle() {
+ return this.title;
+ }
+
+
+ public void setHireDate(Date hireDate) {
+ this.hireDate = hireDate;
+ }
+
+ public Date getHireDate() {
+ return this.hireDate;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Employee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/FullTimeEmployee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/FullTimeEmployee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/FullTimeEmployee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/FullTimeEmployee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_FullTimeEmployee")
+public final class FullTimeEmployee extends Employee
+ implements IFullTimeEmployee {
+ @Basic
+ private float salary;
+
+ public void setSalary(float salary) {
+ this.salary = salary;
+ }
+
+ public float getSalary() {
+ return this.salary;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/FullTimeEmployee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/LineItem.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/LineItem.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/LineItem.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/LineItem.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_LineItem")
+@Table(name="BAS_LineItem") // OPENJPA-121
+public final class LineItem implements ILineItem {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @Basic
+ private int quantity;
+
+ @OneToOne
+ private Product product;
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public int getQuantity() {
+ return this.quantity;
+ }
+
+
+ public void setProduct(IProduct product) {
+ this.product = (Product) product;
+ }
+
+ public IProduct getProduct() {
+ return this.product;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/LineItem.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/PartTimeEmployee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/PartTimeEmployee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/PartTimeEmployee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/PartTimeEmployee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_PartTimeEmployee")
+public final class PartTimeEmployee extends Employee
+ implements IPartTimeEmployee {
+ @Basic
+ private float wage;
+
+ @Basic
+ private int weeklyHours;
+
+ public void setWage(float wage) {
+ this.wage = wage;
+ }
+
+ public float getWage() {
+ return this.wage;
+ }
+
+
+ public void setWeeklyHours(int weeklyHours) {
+ this.weeklyHours = weeklyHours;
+ }
+
+ public int getWeeklyHours() {
+ return this.weeklyHours;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/PartTimeEmployee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Person.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Person.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Person.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Person.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_Person")
+@Table(name="BAS_Person") // OPENJPA-121
+@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
+public abstract class Person implements IPerson {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @Basic
+ private String firstName;
+
+ @Basic
+ private String lastName;
+
+ @OneToOne
+ private Address homeAddress;
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getFirstName() {
+ return this.firstName;
+ }
+
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getLastName() {
+ return this.lastName;
+ }
+
+
+ public void setHomeAddress(IAddress homeAddress) {
+ this.homeAddress = (Address) homeAddress;
+ }
+
+ public IAddress getHomeAddress() {
+ return this.homeAddress;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Person.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Product.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Product.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Product.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Product.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import java.util.*;
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_Product")
+@Table(name="BAS_Product") // OPENJPA-121
+public final class Product implements IProduct {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @Basic
+ private String name;
+
+ @Basic
+ private byte[] image;
+
+ @Basic
+ private float price;
+
+ @ManyToMany
+ private Set<Company> distributors = new HashSet<Company>();
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+
+ public void setImage(byte[] image) {
+ this.image = image;
+ }
+
+ public byte[] getImage() {
+ return this.image;
+ }
+
+
+ public void setPrice(float price) {
+ this.price = price;
+ }
+
+ public float getPrice() {
+ return this.price;
+ }
+
+
+ public void setDistributors(Set<? extends ICompany> distributors) {
+ this.distributors = (Set<Company>) distributors;
+ }
+
+ public Set<Company> getDistributors() {
+ return this.distributors;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/Product.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/ProductOrder.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/ProductOrder.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/ProductOrder.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/ProductOrder.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import java.util.*;
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="BAS_ProductOrder")
+@Table(name="BAS_ProductOrder") // OPENJPA-121
+public final class ProductOrder implements IProductOrder {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @OneToMany
+ private List<LineItem> items = new LinkedList<LineItem>();
+
+ @Basic
+ private Date orderDate;
+
+ @Basic
+ private Date shippedDate;
+
+ @OneToOne
+ private Customer customer;
+
+ public void setItems(List<? extends ILineItem> items) {
+ this.items = (List<LineItem>) items;
+ }
+
+ public List<LineItem> getItems() {
+ return this.items;
+ }
+
+
+ public void setOrderDate(Date orderDate) {
+ this.orderDate = orderDate;
+ }
+
+ public Date getOrderDate() {
+ return this.orderDate;
+ }
+
+
+ public void setShippedDate(Date shippedDate) {
+ this.shippedDate = shippedDate;
+ }
+
+ public Date getShippedDate() {
+ return this.shippedDate;
+ }
+
+
+ public void setCustomer(ICustomer customer) {
+ this.customer = (Customer) customer;
+ }
+
+ public ICustomer getCustomer() {
+ return this.customer;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/ProductOrder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/TestBasicCompanyModel.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/TestBasicCompanyModel.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/TestBasicCompanyModel.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/TestBasicCompanyModel.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.basic;
+
+import org.apache.openjpa.persistence.models.company.*;
+
+public class TestBasicCompanyModel extends CompanyModelTest {
+}
+
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/basic/TestBasicCompanyModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Address.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Address.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Address.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Address.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.fetchlazy;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="LAZ_Address")
+@Table(name="LAZ_Address") // OPENJPA-121
+public final class Address implements IAddress {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @Basic(fetch=FetchType.LAZY)
+ private String streetAddress;
+
+ @Basic(fetch=FetchType.LAZY)
+ private String city;
+
+ @Basic(fetch=FetchType.LAZY)
+ private String state;
+
+ @Basic(fetch=FetchType.LAZY)
+ private String postalCode;
+
+ @Basic(fetch=FetchType.LAZY)
+ private String phoneNumber;
+
+ public void setStreetAddress(String streetAddress) {
+ this.streetAddress = streetAddress;
+ }
+
+ public String getStreetAddress() {
+ return this.streetAddress;
+ }
+
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getCity() {
+ return this.city;
+ }
+
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getState() {
+ return this.state;
+ }
+
+
+ public void setPostalCode(String postalCode) {
+ this.postalCode = postalCode;
+ }
+
+ public String getPostalCode() {
+ return this.postalCode;
+ }
+
+
+ public void setPhoneNumber(String phoneNumber) {
+ this.phoneNumber = phoneNumber;
+ }
+
+ public String getPhoneNumber() {
+ return this.phoneNumber;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Address.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Company.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Company.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Company.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Company.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.fetchlazy;
+
+import java.util.*;
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="LAZ_Company")
+@Table(name="LAZ_Company") // OPENJPA-121
+public final class Company implements ICompany {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @Basic(fetch=FetchType.LAZY)
+ private String name;
+
+ @OneToOne(fetch=FetchType.LAZY)
+ private Address address;
+
+ @OneToMany(mappedBy="company", fetch=FetchType.LAZY)
+ private Set<Employee> employees = new HashSet<Employee>();
+
+ @ManyToMany(mappedBy="distributors", fetch=FetchType.LAZY)
+ private Set<Product> products = new HashSet<Product>();
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+
+ public void setAddress(IAddress address) {
+ this.address = (Address) address;
+ }
+
+ public IAddress getAddress() {
+ return this.address;
+ }
+
+
+ public void setEmployees(Set<? extends IEmployee> employees) {
+ this.employees = (Set<Employee>) employees;
+ }
+
+ public Set<Employee> getEmployees() {
+ return this.employees;
+ }
+
+
+ public void setProducts(Set<? extends IProduct> products) {
+ this.products = (Set<Product>) products;
+ }
+
+ public Set<Product> getProducts() {
+ return this.products;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Company.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Customer.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Customer.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Customer.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Customer.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.fetchlazy;
+
+import java.util.*;
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="LAZ_Customer")
+public final class Customer extends Person implements ICustomer {
+ @OneToMany(mappedBy="customer",fetch=FetchType.LAZY)
+ private Collection<ProductOrder> orders = new ArrayList<ProductOrder>();
+
+ @OneToOne(fetch=FetchType.LAZY)
+ private Address shippingAddress;
+
+ @OneToOne(fetch=FetchType.LAZY)
+ private Address billingAddress;
+
+ public void setOrders(Collection<? extends IProductOrder> orders) {
+ this.orders = (Collection<ProductOrder>) orders;
+ }
+
+ public Collection<ProductOrder> getOrders() {
+ return this.orders;
+ }
+
+
+ public void setShippingAddress(IAddress shippingAddress) {
+ this.shippingAddress = (Address) shippingAddress;
+ }
+
+ public IAddress getShippingAddress() {
+ return this.shippingAddress;
+ }
+
+
+ public void setBillingAddress(IAddress billingAddress) {
+ this.billingAddress = (Address) billingAddress;
+ }
+
+ public IAddress getBillingAddress() {
+ return this.billingAddress;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Customer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Employee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Employee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Employee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Employee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.fetchlazy;
+
+import java.util.*;
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="LAZ_Employee")
+public abstract class Employee extends Person implements IEmployee {
+ @OneToOne(fetch=FetchType.LAZY)
+ private FullTimeEmployee manager;
+
+ @OneToOne(fetch=FetchType.LAZY)
+ private Company company;
+
+ @Basic(fetch=FetchType.LAZY)
+ private String title;
+
+ @Basic(fetch=FetchType.LAZY)
+ private Date hireDate;
+
+ public void setManager(IFullTimeEmployee manager) {
+ this.manager = (FullTimeEmployee) manager;
+ }
+
+ public IFullTimeEmployee getManager() {
+ return this.manager;
+ }
+
+
+ public void setCompany(ICompany company) {
+ this.company = (Company) company;
+ }
+
+ public ICompany getCompany() {
+ return this.company;
+ }
+
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getTitle() {
+ return this.title;
+ }
+
+
+ public void setHireDate(Date hireDate) {
+ this.hireDate = hireDate;
+ }
+
+ public Date getHireDate() {
+ return this.hireDate;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/Employee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/FullTimeEmployee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/FullTimeEmployee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/FullTimeEmployee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/FullTimeEmployee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.fetchlazy;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="LAZ_FullTimeEmployee")
+public final class FullTimeEmployee extends Employee
+ implements IFullTimeEmployee {
+ @Basic(fetch=FetchType.LAZY)
+ private float salary;
+
+ public void setSalary(float salary) {
+ this.salary = salary;
+ }
+
+ public float getSalary() {
+ return this.salary;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/FullTimeEmployee.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/LineItem.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/LineItem.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/LineItem.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/LineItem.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.fetchlazy;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="LAZ_LineItem")
+@Table(name="LAZ_LineItem") // OPENJPA-121
+public final class LineItem implements ILineItem {
+ private static long idCounter = System.currentTimeMillis();
+
+ @Id
+ private long id = idCounter++;
+
+ @Basic(fetch=FetchType.LAZY)
+ private int quantity;
+
+ @OneToOne(fetch=FetchType.LAZY)
+ private Product product;
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public int getQuantity() {
+ return this.quantity;
+ }
+
+
+ public void setProduct(IProduct product) {
+ this.product = (Product) product;
+ }
+
+ public IProduct getProduct() {
+ return this.product;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/LineItem.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/PartTimeEmployee.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/PartTimeEmployee.java?view=auto&rev=505160
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/PartTimeEmployee.java (added)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/PartTimeEmployee.java Thu Feb 8 19:49:22 2007
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 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.openjpa.persistence.models.company.fetchlazy;
+
+import javax.persistence.*;
+import org.apache.openjpa.persistence.models.company.*;
+
+@Entity(name="LAZ_PartTimeEmployee")
+public final class PartTimeEmployee extends Employee
+ implements IPartTimeEmployee {
+ @Basic(fetch=FetchType.LAZY)
+ private float wage;
+
+ @Basic(fetch=FetchType.LAZY)
+ private int weeklyHours;
+
+ public void setWage(float wage) {
+ this.wage = wage;
+ }
+
+ public float getWage() {
+ return this.wage;
+ }
+
+
+ public void setWeeklyHours(int weeklyHours) {
+ this.weeklyHours = weeklyHours;
+ }
+
+ public int getWeeklyHours() {
+ return this.weeklyHours;
+ }
+}
Propchange: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/models/fetchlazy/PartTimeEmployee.java
------------------------------------------------------------------------------
svn:eol-style = native