OPENJPA-1536: set svn:eol-style

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@940555 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2010-05-03 18:21:14 +00:00
parent 0b73d9f1a9
commit ed2940d547
6 changed files with 444 additions and 444 deletions

View File

@ -1,87 +1,87 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.openjpa.persistence.inheritance; package org.apache.openjpa.persistence.inheritance;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import org.apache.openjpa.persistence.inheritance.entity.Department; import org.apache.openjpa.persistence.inheritance.entity.Department;
import org.apache.openjpa.persistence.inheritance.entity.Employee; import org.apache.openjpa.persistence.inheritance.entity.Employee;
import org.apache.openjpa.persistence.inheritance.entity.FTEmployee; import org.apache.openjpa.persistence.inheritance.entity.FTEmployee;
import org.apache.openjpa.persistence.inheritance.entity.PTEmployee; import org.apache.openjpa.persistence.inheritance.entity.PTEmployee;
import org.apache.openjpa.persistence.inheritance.entity.Manager; import org.apache.openjpa.persistence.inheritance.entity.Manager;
import org.apache.openjpa.persistence.test.SingleEMFTestCase; import org.apache.openjpa.persistence.test.SingleEMFTestCase;
/** /**
* Originally reported in the context of entities of a inheritance hierarchy with * Originally reported in the context of entities of a inheritance hierarchy with
* JOIN_TABLE strategy. * JOIN_TABLE strategy.
* *
* <A HREF="http://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A> * <A HREF="http://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A>
* *
* @author Jody Grassel * @author Jody Grassel
* @author Fay Wang * @author Fay Wang
* *
*/ */
public class TestJoinTableStrategy extends SingleEMFTestCase { public class TestJoinTableStrategy extends SingleEMFTestCase {
public void setUp() { public void setUp() {
super.setUp(CLEAR_TABLES, Department.class, Employee.class, super.setUp(CLEAR_TABLES, Department.class, Employee.class,
PTEmployee.class, FTEmployee.class, Manager.class); PTEmployee.class, FTEmployee.class, Manager.class);
EntityManager em = emf.createEntityManager(); EntityManager em = emf.createEntityManager();
em.getTransaction().begin(); em.getTransaction().begin();
Manager m = new Manager(); Manager m = new Manager();
m.setId(1); m.setId(1);
m.setFirstName("mf1"); m.setFirstName("mf1");
m.setLastName("ml1"); m.setLastName("ml1");
m.setSalary(1000000); m.setSalary(1000000);
m.setVacationDays(20); m.setVacationDays(20);
Department d = new Department(); Department d = new Department();
d.setId(1); d.setId(1);
d.setDepartmentName("d1"); d.setDepartmentName("d1");
d.setDepartmentManager(m); d.setDepartmentManager(m);
m.setDepartment(d); m.setDepartment(d);
Employee e1 = new Employee(); Employee e1 = new Employee();
e1.setId(2); e1.setId(2);
e1.setFirstName("ef1"); e1.setFirstName("ef1");
e1.setLastName("el1"); e1.setLastName("el1");
e1.setDepartment(d); e1.setDepartment(d);
e1.setManager(m); e1.setManager(m);
e1.setVacationDays(20); e1.setVacationDays(20);
em.persist(m); em.persist(m);
em.persist(d); em.persist(d);
em.persist(e1); em.persist(e1);
em.getTransaction().commit(); em.getTransaction().commit();
em.close(); em.close();
} }
@Override @Override
public void tearDown() { public void tearDown() {
// problem deleting table in MySQL // problem deleting table in MySQL
} }
public void testFindEntity() { public void testFindEntity() {
EntityManager em1 = emf.createEntityManager(); EntityManager em1 = emf.createEntityManager();
Manager m = em1.find(Manager.class, 1); Manager m = em1.find(Manager.class, 1);
assertNotNull(m); assertNotNull(m);
em1.close(); em1.close();
} }
} }

View File

@ -1,91 +1,91 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.openjpa.persistence.inheritance.entity; package org.apache.openjpa.persistence.inheritance.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
/** /**
* Test case and domain classes were originally part of the reported issue * Test case and domain classes were originally part of the reported issue
* <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A> * <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A>
* *
* @author Jody Grassel * @author Jody Grassel
* @author Fay Wang * @author Fay Wang
* *
*/ */
@Entity @Entity
@Table(name="CDepartment") @Table(name="CDepartment")
public class Department { public class Department {
@Id @Id
private int id; private int id;
private String departmentName; private String departmentName;
@ManyToOne @ManyToOne
private Manager departmentManager; private Manager departmentManager;
@OneToMany(mappedBy="department") @OneToMany(mappedBy="department")
private List<Employee> employeeList; private List<Employee> employeeList;
public Department() { public Department() {
this.employeeList = new ArrayList<Employee>(); this.employeeList = new ArrayList<Employee>();
} }
public Department(int id, String departmentName) { public Department(int id, String departmentName) {
this.employeeList = new ArrayList<Employee>(); this.employeeList = new ArrayList<Employee>();
this.id = id; this.id = id;
this.departmentName = departmentName; this.departmentName = departmentName;
} }
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }
public String getDepartmentName() { public String getDepartmentName() {
return departmentName; return departmentName;
} }
public void setDepartmentName(String departmentName) { public void setDepartmentName(String departmentName) {
this.departmentName = departmentName; this.departmentName = departmentName;
} }
public Manager getDepartmentManager() { public Manager getDepartmentManager() {
return departmentManager; return departmentManager;
} }
public void setDepartmentManager(Manager departmentManager) { public void setDepartmentManager(Manager departmentManager) {
this.departmentManager = departmentManager; this.departmentManager = departmentManager;
} }
public List<Employee> getEmployeeList() { public List<Employee> getEmployeeList() {
return employeeList; return employeeList;
} }
} }

View File

@ -1,123 +1,123 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.openjpa.persistence.inheritance.entity; package org.apache.openjpa.persistence.inheritance.entity;
import javax.persistence.DiscriminatorColumn; import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType; import javax.persistence.DiscriminatorType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Inheritance; import javax.persistence.Inheritance;
import javax.persistence.InheritanceType; import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version; import javax.persistence.Version;
/** /**
* Test case and domain classes were originally part of the reported issue * Test case and domain classes were originally part of the reported issue
* <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A> * <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A>
* *
* @author Jody Grassel * @author Jody Grassel
* @author Fay Wang * @author Fay Wang
* *
*/ */
@Entity @Entity
@Table(name="CEmployee") @Table(name="CEmployee")
@Inheritance(strategy=InheritanceType.JOINED) @Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="EMP_TYPEL", discriminatorType=DiscriminatorType.INTEGER) @DiscriminatorColumn(name="EMP_TYPEL", discriminatorType=DiscriminatorType.INTEGER)
public class Employee { public class Employee {
@Id @Id
private int id; private int id;
private String lastName; private String lastName;
private String firstName; private String firstName;
private int vacationDays; private int vacationDays;
@ManyToOne @ManyToOne
private Manager manager; private Manager manager;
@ManyToOne @ManyToOne
private Department department; private Department department;
@Version @Version
private long version; private long version;
private transient String str = null; private transient String str = null;
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
str = null; str = null;
} }
public String getLastName() { public String getLastName() {
return lastName; return lastName;
} }
public void setLastName(String lastName) { public void setLastName(String lastName) {
this.lastName = lastName; this.lastName = lastName;
str = null; str = null;
} }
public String getFirstName() { public String getFirstName() {
return firstName; return firstName;
} }
public void setFirstName(String firstName) { public void setFirstName(String firstName) {
this.firstName = firstName; this.firstName = firstName;
str = null; str = null;
} }
public int getVacationDays() { public int getVacationDays() {
return vacationDays; return vacationDays;
} }
public void setVacationDays(int vacationDays) { public void setVacationDays(int vacationDays) {
this.vacationDays = vacationDays; this.vacationDays = vacationDays;
str = null; str = null;
} }
public Manager getManager() { public Manager getManager() {
return manager; return manager;
} }
public void setManager(Manager manager) { public void setManager(Manager manager) {
this.manager = manager; this.manager = manager;
str = null; str = null;
} }
public Department getDepartment() { public Department getDepartment() {
return department; return department;
} }
public void setDepartment(Department department) { public void setDepartment(Department department) {
this.department = department; this.department = department;
str = null; str = null;
} }
public long getVersion() { public long getVersion() {
return version; return version;
} }
} }

View File

@ -1,46 +1,46 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.openjpa.persistence.inheritance.entity; package org.apache.openjpa.persistence.inheritance.entity;
import javax.persistence.DiscriminatorValue; import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity; import javax.persistence.Entity;
/** /**
* Test case and domain classes were originally part of the reported issue * Test case and domain classes were originally part of the reported issue
* <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A> * <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A>
* *
* @author Jody Grassel * @author Jody Grassel
* @author Fay Wang * @author Fay Wang
* *
*/ */
@Entity @Entity
@DiscriminatorValue("2") @DiscriminatorValue("2")
public class FTEmployee extends Employee { public class FTEmployee extends Employee {
private double salary; private double salary;
public double getSalary() { public double getSalary() {
return salary; return salary;
} }
public void setSalary(double salary) { public void setSalary(double salary) {
this.salary = salary; this.salary = salary;
} }
} }

View File

@ -1,50 +1,50 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.openjpa.persistence.inheritance.entity; package org.apache.openjpa.persistence.inheritance.entity;
import java.util.List; import java.util.List;
import javax.persistence.DiscriminatorValue; import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
/** /**
* Test case and domain classes were originally part of the reported issue * Test case and domain classes were originally part of the reported issue
* <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A> * <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A>
* *
* @author Jody Grassel * @author Jody Grassel
* @author Fay Wang * @author Fay Wang
* *
*/ */
@Entity @Entity
@DiscriminatorValue("3") @DiscriminatorValue("3")
public class Manager extends FTEmployee { public class Manager extends FTEmployee {
@OneToMany(mappedBy="manager") @OneToMany(mappedBy="manager")
private List<Employee> managesList; private List<Employee> managesList;
public List<Employee> getManagesList() { public List<Employee> getManagesList() {
return managesList; return managesList;
} }
public String toString() { public String toString() {
String str = super.toString(); String str = super.toString();
return "Manager " + str; return "Manager " + str;
} }
} }

View File

@ -1,47 +1,47 @@
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.openjpa.persistence.inheritance.entity; package org.apache.openjpa.persistence.inheritance.entity;
import javax.persistence.*; import javax.persistence.*;
/** /**
* Test case and domain classes were originally part of the reported issue * Test case and domain classes were originally part of the reported issue
* <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A> * <A href="https://issues.apache.org/jira/browse/OPENJPA-1536">OPENJPA-1536</A>
* *
* @author Jody Grassel * @author Jody Grassel
* @author Fay Wang * @author Fay Wang
* *
*/ */
@Entity @Entity
@DiscriminatorValue("1") @DiscriminatorValue("1")
public class PTEmployee extends Employee { public class PTEmployee extends Employee {
private float hourlyWage; private float hourlyWage;
public PTEmployee() { public PTEmployee() {
super(); super();
} }
public float getHourlyWage() { public float getHourlyWage() {
return hourlyWage; return hourlyWage;
} }
public void setHourlyWage(float hourlyWage) { public void setHourlyWage(float hourlyWage) {
this.hourlyWage = hourlyWage; this.hourlyWage = hourlyWage;
} }
} }