You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pc...@apache.org on 2008/02/15 10:20:40 UTC
svn commit: r627979 [34/39] - in /openjpa/trunk:
openjpa-lib/src/test/java/org/apache/openjpa/lib/test/
openjpa-persistence-jdbc/ openjpa-persistence-jdbc/src/test/java/
openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/
openjpa-per...
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/LockGroupPC2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/LockGroupPC2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/LockGroupPC2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/LockGroupPC2.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.persistence.Entity;
+
+/**
+ * <p>Used to test lock-group="none" in isolation.</p>
+ *
+ * @author Abe White
+ */
+@Entity
+public class LockGroupPC2 {
+
+ private String name;
+ private List list = new ArrayList();
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List getList() {
+ return this.list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/LockGroupPCKnownSubclass.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/LockGroupPCKnownSubclass.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/LockGroupPCKnownSubclass.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/LockGroupPCKnownSubclass.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class LockGroupPCKnownSubclass
+ extends LockGroupPC {
+
+ private String knownSubclassStringField;
+
+ public void setKnownSubclassStringField(String knownSubclassStringField) {
+ this.knownSubclassStringField = knownSubclassStringField;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterface.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterface.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterface.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterface.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.Set;
+
+public interface ManagedInterface extends ManagedInterfaceSup {
+
+ public int getIntField();
+
+ public void setIntField(int i);
+
+ public ManagedInterfaceEmbed getEmbed();
+
+ public void setEmbed(ManagedInterfaceEmbed embed);
+
+ public ManagedInterface getSelf();
+
+ public void setSelf(ManagedInterface iface);
+
+ public Set getSetInteger();
+
+ public void setSetInteger(Set collection);
+
+ public Set getSetPC();
+
+ public void setSetPC(Set collection);
+
+ public Set getSetI();
+
+ public void setSetI(Set collection);
+
+ public RuntimeTest1 getPC();
+
+ public void setPC(RuntimeTest1 pc);
+
+ public void unimplemented();
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceAppId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceAppId.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceAppId.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceAppId.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.Set;
+
+public interface ManagedInterfaceAppId extends ManagedInterfaceSupAppId {
+
+ public int getIntField();
+
+ public void setIntField(int i);
+
+ public ManagedInterfaceEmbed getEmbed();
+
+ public void setEmbed(ManagedInterfaceEmbed embed);
+
+ public ManagedInterfaceAppId getSelf();
+
+ public void setSelf(ManagedInterfaceAppId iface);
+
+ public Set getSetInteger();
+
+ public void setSetInteger(Set collection);
+
+ public Set getSetPC();
+
+ public void setSetPC(Set collection);
+
+ public Set getSetI();
+
+ public void setSetI(Set collection);
+
+ public RuntimeTest1 getPC();
+
+ public void setPC(RuntimeTest1 pc);
+
+ public void unimplemented();
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceEmbed.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceEmbed.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceEmbed.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceEmbed.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+public interface ManagedInterfaceEmbed {
+
+ public int getIntField();
+
+ public void setIntField(int i);
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceOwner.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceOwner.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceOwner.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceOwner.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class ManagedInterfaceOwner {
+
+ private int intField;
+ private ManagedInterfaceSup iface;
+ private ManagedInterfaceEmbed embed;
+
+ public int getIntField() {
+ return intField;
+ }
+
+ public void setIntField(int i) {
+ intField = i;
+ }
+
+ public ManagedInterfaceSup getIFace() {
+ return iface;
+ }
+
+ public void setIFace(ManagedInterfaceSup iface) {
+ this.iface = iface;
+ }
+
+ public ManagedInterfaceEmbed getEmbed() {
+ return embed;
+ }
+
+ public void setEmbed(ManagedInterfaceEmbed embed) {
+ this.embed = embed;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceOwnerAppId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceOwnerAppId.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceOwnerAppId.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceOwnerAppId.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class ManagedInterfaceOwnerAppId {
+
+ private int intField;
+ private ManagedInterfaceSupAppId iface;
+
+ public int getIntField() {
+ return intField;
+ }
+
+ public void setIntField(int i) {
+ intField = i;
+ }
+
+ public ManagedInterfaceSupAppId getIFace() {
+ return iface;
+ }
+
+ public void setIFace(ManagedInterfaceSupAppId iface) {
+ this.iface = iface;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceSup.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceSup.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceSup.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceSup.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+public interface ManagedInterfaceSup {
+
+ public int getIntFieldSup();
+
+ public void setIntFieldSup(int i);
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceSupAppId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceSupAppId.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceSupAppId.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ManagedInterfaceSupAppId.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.StringTokenizer;
+
+public interface ManagedInterfaceSupAppId {
+
+ public int getId1();
+
+ public void setId1(int i);
+
+ public int getId2();
+
+ public void setId2(int i);
+
+ public int getIntFieldSup();
+
+ public void setIntFieldSup(int i);
+
+ public static class Id implements java.io.Serializable {
+
+ public int id1;
+ public int id2;
+
+ public Id() {
+ }
+
+ public Id(String str) {
+ StringTokenizer tok = new StringTokenizer(str, ",");
+ id1 = Integer.parseInt(tok.nextToken());
+ id2 = Integer.parseInt(tok.nextToken());
+ }
+
+ public String toString() {
+ return id1 + "," + id2;
+ }
+
+ public int hashCode() {
+ return id1 + id2;
+ }
+
+ public boolean equals(Object o) {
+ if (!(o instanceof Id))
+ return false;
+ Id other = (Id) o;
+ return id1 == other.id1 && id2 == other.id2;
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementIntf.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementIntf.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementIntf.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementIntf.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+public interface MapElementIntf {
+
+ public String getElementData();
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementPC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementPC.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementPC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementPC.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
+
+@Entity
+public class MapElementPC
+ implements MapElementIntf {
+
+ private String elementData = AbstractTestCase.randomString();
+
+ public void setElementData(String elementData) {
+ this.elementData = elementData;
+ }
+
+ public String getElementData() {
+ return this.elementData;
+ }
+
+ public int hashCode() {
+ return elementData.hashCode();
+ }
+
+ public boolean equals(Object other) {
+ return ((MapElementPC) other).elementData.equals(elementData);
+ }
+
+ public String toString() {
+ return super.toString() + "::" + elementData;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementPCChild.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementPCChild.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementPCChild.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MapElementPCChild.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
+
+@Entity
+public class MapElementPCChild
+ extends MapElementPC {
+
+ private String elementDataChild = AbstractTestCase.randomString();
+
+ public void setElementDataChild(String elementDataChild) {
+ this.elementDataChild = elementDataChild;
+ }
+
+ public String getElementDataChild() {
+ return this.elementDataChild;
+ }
+
+ public int hashCode() {
+ return (super.hashCode() + elementDataChild.hashCode())
+ % Integer.MAX_VALUE;
+ }
+
+ public boolean equals(Object other) {
+ return super.equals(other) &&
+ ((MapElementPCChild) other)
+ .elementDataChild.equals(elementDataChild);
+ }
+
+ public String toString() {
+ return super.toString() + "::" + elementDataChild;
+ }
+}
+
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MixedInterface.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MixedInterface.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MixedInterface.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MixedInterface.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+public interface MixedInterface {
+
+ public int getIntField();
+
+ public void setIntField(int i);
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MixedInterfaceImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MixedInterfaceImpl.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MixedInterfaceImpl.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/MixedInterfaceImpl.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class MixedInterfaceImpl implements MixedInterface {
+
+ private int intField;
+
+ public int getIntField() {
+ return intField;
+ }
+
+ public void setIntField(int i) {
+ intField = i;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModInstanceCallbackTests.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModInstanceCallbackTests.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModInstanceCallbackTests.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModInstanceCallbackTests.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.OneToOne;
+import javax.persistence.PostLoad;
+import javax.persistence.PrePersist;
+import javax.persistence.PreRemove;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.OpenJPAPersistence;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@Table(name = "modicbt")
+public class ModInstanceCallbackTests {
+
+ public static long preDeleteInvocations = 0;
+ public static long postLoadInvocations = 0;
+ public static long preStoreInvocations = 0;
+ public static long preClearInvocations = 0;
+
+ public transient boolean postLoadCalled = false;
+ public transient boolean preStoreCalled = false;
+ public transient boolean preDeleteCalled = false;
+ public transient boolean preClearCalled = false;
+
+ public transient int preDeleteCycle = -1;
+ public transient boolean flushInPreStore = false;
+
+ // this string should never be null in jdoPostLoad
+ @Column(length = 35)
+ private String nonNullString = null;
+
+ @Column(length = 35)
+ private String stringField = null;
+ @Basic
+ private int intField = 0;
+ @Basic
+ private int nonDFGField = 0;
+
+ @OneToOne(cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
+ private ModRuntimeTest1 oneOne = null;
+
+ @OneToOne(cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
+ private ModInstanceCallbackTests rel;
+ private transient Object relId;
+
+ public ModInstanceCallbackTests() {
+ }
+
+ public ModInstanceCallbackTests(String stringField, int intField) {
+ this.stringField = stringField;
+ this.intField = intField;
+ }
+
+ public void setNonNullString(String val) {
+ nonNullString = val;
+ }
+
+ public String getStringField() {
+ return this.stringField;
+ }
+
+ public void setStringField(String stringField) {
+ this.stringField = stringField;
+ }
+
+ public int getIntField() {
+ return this.intField;
+ }
+
+ public void setIntField(int intField) {
+ this.intField = intField;
+ }
+
+ public int getNonDFGField() {
+ return this.nonDFGField;
+ }
+
+ public void setNonDFGField(int nonDFGField) {
+ this.nonDFGField = nonDFGField;
+ }
+
+ public ModRuntimeTest1 getOneOne() {
+ return this.oneOne;
+ }
+
+ public void setOneOne(ModRuntimeTest1 oneOne) {
+ this.oneOne = oneOne;
+ }
+
+ @PostLoad
+ public void jdoPostLoad() {
+ postLoadInvocations++;
+
+ postLoadCalled = true;
+ if (nonNullString == null)
+ throw new IllegalStateException();
+ }
+
+ public void jdoPreClear() {
+ preClearInvocations++;
+
+ preClearCalled = true;
+ }
+
+ @PrePersist
+ @PreUpdate
+ public void jdoPreStore() {
+ preStoreInvocations++;
+
+ preStoreCalled = true;
+
+ // ensure that whenever this object is persisted,
+ // nonNullString is, in fact, not null.
+ if (nonNullString == null)
+ nonNullString = "** this string is not null **";
+
+ // assign new value to relation; should get persisted
+ if ("bar".equals(stringField))
+ oneOne = new ModRuntimeTest1("jdoPreStore", 100);
+ if (relId != null) {
+ ModInstanceCallbackTests rel = (ModInstanceCallbackTests)
+ OpenJPAPersistence.getEntityManager(this)
+ .find(ModInstanceCallbackTests.class, relId);
+ rel.setRel(this);
+ rel.setIntField(8888);
+ }
+
+ if (flushInPreStore) {
+ OpenJPAEntityManager pm = OpenJPAPersistence.getEntityManager(this);
+ if (pm != null)
+ pm.flush();
+ }
+ }
+
+ @PreRemove
+ public void jdoPreDelete() {
+ preDeleteInvocations++;
+ preDeleteCalled = true;
+ if (preDeleteCycle >= 0 && preDeleteCycle < 5) {
+ preDeleteCycle++;
+ OpenJPAPersistence.getEntityManager(this).remove(this);
+ }
+ }
+
+ public ModInstanceCallbackTests getRel() {
+ return this.rel;
+ }
+
+ public void setRel(ModInstanceCallbackTests rel) {
+ this.rel = rel;
+ }
+
+ public Object getRelId() {
+ return this.relId;
+ }
+
+ public void setRelId(Object relId) {
+ this.relId = relId;
+ }
+}
\ No newline at end of file
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModRuntimeTest1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModRuntimeTest1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModRuntimeTest1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModRuntimeTest1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+@Entity
+@Table(name = "Modrtest1")
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+public class ModRuntimeTest1 {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ public int id;
+
+ @Transient
+ public static final String someStaticField = "someField";
+
+ private Locale localeField;
+
+ private int intField;
+
+ @Column(length = 35)
+ private String stringField;
+
+ @Column(length = 35)
+ public String transString;
+
+ @ManyToOne(cascade = { CascadeType.PERSIST })
+ private ModRuntimeTest1 selfOneOne;
+
+ @OneToMany(cascade = { CascadeType.PERSIST })
+ private Set<ModRuntimeTest1> selfOneMany = new HashSet<ModRuntimeTest1>();
+
+ public ModRuntimeTest1() {
+ }
+
+ public ModRuntimeTest1(String str, int i) {
+ stringField = str;
+ intField = i;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public int getIntField() {
+ return this.intField;
+ }
+
+ public void setIntField(int intField) {
+ this.intField = intField;
+ }
+
+ public String getStringField() {
+ return this.stringField;
+ }
+
+ public void setStringField(String stringField) {
+ this.stringField = stringField;
+ }
+
+ public ModRuntimeTest1 getSelfOneOne() {
+ return this.selfOneOne;
+ }
+
+ public void setSelfOneOne(ModRuntimeTest1 selfOneOne) {
+ this.selfOneOne = selfOneOne;
+ }
+
+ public Set getSelfOneMany() {
+ return this.selfOneMany;
+ }
+
+ public void setSelfOneMany(Set selfOneMany) {
+ this.selfOneMany = selfOneMany;
+ }
+
+ public String toString() {
+ return "IntField: " + intField + ", StringField: " + stringField + " .";
+ }
+
+ public Locale getLocaleField() {
+ return localeField;
+ }
+
+ public void setLocaleField(Locale localeField) {
+ this.localeField = localeField;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModRuntimeTest2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModRuntimeTest2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModRuntimeTest2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ModRuntimeTest2.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+@Entity
+@DiscriminatorValue("ModRT2")
+public class ModRuntimeTest2 extends ModRuntimeTest1 {
+
+ private static final long serialVersionUID = 1L;
+
+ private int intField2;
+
+ public ModRuntimeTest2() {
+ }
+
+ public ModRuntimeTest2(String str, int i) {
+ super(str, i);
+ }
+
+ public int getIntField2() {
+ return this.intField2;
+ }
+
+ public void setIntField2(int intField2) {
+ this.intField2 = intField2;
+ }
+
+ public String toString() {
+ return "IntField: " + intField2 + ", StringField: "
+ + super.getStringField() + " .";
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/NonMappedInterface.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/NonMappedInterface.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/NonMappedInterface.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/NonMappedInterface.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+public interface NonMappedInterface {
+
+ public int getIntField();
+
+ public void setIntField(int i);
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/NonMappedInterfaceImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/NonMappedInterfaceImpl.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/NonMappedInterfaceImpl.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/NonMappedInterfaceImpl.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class NonMappedInterfaceImpl
+ implements NonMappedInterface {
+
+ private int mismatch;
+
+ public int getIntField() {
+ return mismatch;
+ }
+
+ public void setIntField(int i) {
+ mismatch = i;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ObjectCollectionHolder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ObjectCollectionHolder.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ObjectCollectionHolder.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ObjectCollectionHolder.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.HashSet;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "objchol")
+public class ObjectCollectionHolder {
+
+ @Id
+ private int id;
+ private HashSet hashSet = new HashSet();
+
+ public void setHashSet(HashSet hashSet) {
+ this.hashSet = hashSet;
+ }
+
+ public HashSet getHashSet() {
+ return this.hashSet;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addToHashSet(Object ob) {
+ getHashSet().add(ob);
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+}
\ No newline at end of file
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/OuterJoinValuePC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/OuterJoinValuePC.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/OuterJoinValuePC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/OuterJoinValuePC.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "outerjvp")
+public class OuterJoinValuePC {
+
+ private String stringField;
+ private int value1;
+ private int value2;
+
+ private int id;
+
+ public OuterJoinValuePC() {
+ }
+
+ public OuterJoinValuePC(int id) {
+ this.id = id;
+ }
+
+ @Column(length = 50)
+ public String getStringField() {
+ return this.stringField;
+ }
+
+ public void setStringField(String stringField) {
+ this.stringField = stringField;
+ }
+
+ public int getValue1() {
+ return this.value1;
+ }
+
+ public void setValue1(int value1) {
+ this.value1 = value1;
+ }
+
+ public int getValue2() {
+ return this.value2;
+ }
+
+ public void setValue2(int value2) {
+ this.value2 = value2;
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCAddress.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCAddress.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCAddress.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCAddress.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.ManyToOne;
+
+import org.apache.openjpa.persistence.FetchAttribute;
+import org.apache.openjpa.persistence.FetchGroup;
+
+/**
+ * @author <A HREF="mailto:pinaki.poddar@gmail.com>Pinaki Poddar</A>
+ */
+@Entity
+@FetchGroup(name = "address.country",
+ attributes = @FetchAttribute(name = "country"))
+public class PCAddress {
+
+ private String street;
+ private String city;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+ private PCCountry country;
+
+ protected PCAddress() {
+ super();
+ }
+
+ public PCAddress(String street, String city, PCCountry country) {
+ setStreet(street);
+ setCity(city);
+ setCountry(country);
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public PCCountry getCountry() {
+ return country;
+ }
+
+ public void setCountry(PCCountry country) {
+ this.country = country;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public static Object reflect(PCAddress instance, String name) {
+ if (instance == null)
+ return null;
+ try {
+ return PCAddress.class.getDeclaredField(name).get(instance);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCClassInterface.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCClassInterface.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCClassInterface.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCClassInterface.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+/**
+ * <p>Interface used with {@link PCClassPC} in testing.</p>
+ *
+ * @author Abe White
+ */
+public interface PCClassInterface {
+
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCClassPC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCClassPC.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCClassPC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCClassPC.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+
+import org.apache.openjpa.persistence.Persistent;
+import org.apache.openjpa.persistence.Type;
+
+/**
+ * <p>Persistent type used in testing.</p>
+ *
+ * @author Abe White
+ */
+@Entity
+public class PCClassPC
+ implements PCClassInterface, Serializable {
+
+ @Persistent
+ @Type(PCClassPC.class)
+ private Object specificPC;
+
+ @Persistent
+ @Type(Entity.class)
+ private Object genericPC;
+
+ @Persistent
+ private Object genericObject;
+
+ @Persistent
+ @Type(PCClassPC.class)
+ private PCClassInterface specificInterface;
+
+ @Persistent
+ private PCClassInterface defaultInterface;
+
+ @Persistent
+ private Serializable serializableInterface;
+
+ @Persistent
+ @Type(Object.class)
+ private PCClassInterface genericInterface;
+
+ public Object getSpecificPC() {
+ return this.specificPC;
+ }
+
+ public void setSpecificPC(Object specificPC) {
+ this.specificPC = specificPC;
+ }
+
+ public Object getGenericPC() {
+ return this.genericPC;
+ }
+
+ public void setGenericPC(Object genericPC) {
+ this.genericPC = genericPC;
+ }
+
+ public Object getGenericObject() {
+ return this.genericObject;
+ }
+
+ public void setGenericObject(Object genericObject) {
+ this.genericObject = genericObject;
+ }
+
+ public PCClassInterface getSpecificInterface() {
+ return this.specificInterface;
+ }
+
+ public void setSpecificInterface(PCClassInterface specificInterface) {
+ this.specificInterface = specificInterface;
+ }
+
+ public PCClassInterface getDefaultInterface() {
+ return this.defaultInterface;
+ }
+
+ public void setDefaultInterface(PCClassInterface defaultInterface) {
+ this.defaultInterface = defaultInterface;
+ }
+
+ public Serializable getSerializableInterface() {
+ return this.serializableInterface;
+ }
+
+ public void setSerializableInterface(Serializable serializableInterface) {
+ this.serializableInterface = serializableInterface;
+ }
+
+ public PCClassInterface getGenericInterface() {
+ return this.genericInterface;
+ }
+
+ public void setGenericInterface(PCClassInterface genericInterface) {
+ this.genericInterface = genericInterface;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCCompany.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCCompany.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCCompany.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCCompany.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+
+import org.apache.openjpa.persistence.FetchAttribute;
+import org.apache.openjpa.persistence.FetchGroup;
+import org.apache.openjpa.persistence.FetchGroups;
+
+/**
+ * @author <A HREF="mailto:pinaki.poddar@gmail.com>Pinaki Poddar</A>
+ */
+@Entity
+@FetchGroups({
+@FetchGroup(name = "company.address",
+ attributes = @FetchAttribute(name = "address")),
+@FetchGroup(name = "company.departments",
+ attributes = @FetchAttribute(name = "departments")),
+@FetchGroup(name = "default", postLoad = false,
+ attributes = @FetchAttribute(name = "name"))
+ })
+public class PCCompany {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private int id;
+
+ private String name;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+ private PCAddress address;
+
+ @ManyToMany(cascade = CascadeType.PERSIST)
+ private Set<PCDepartment> departments;
+
+ public PCCompany() {
+ super();
+ }
+
+ public PCCompany(String name) {
+ super();
+ setName(name);
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public PCAddress getAddress() {
+ return address;
+ }
+
+ public void setAddress(PCAddress address) {
+ this.address = address;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Set getDepartments() {
+ return departments;
+ }
+
+ public void setDepartments(Set departments) {
+ this.departments = departments;
+ }
+
+ public void addDepartment(PCDepartment dept) {
+ if (departments == null)
+ departments = new HashSet();
+ departments.add(dept);
+ dept.setCompany(this);
+ }
+
+ public boolean contains(PCDepartment dept) {
+ return departments != null && departments.contains(dept);
+ }
+
+ public static Object reflect(PCCompany instance, String name) {
+ if (instance == null)
+ return null;
+ try {
+ return PCCompany.class.getDeclaredField(name).get(instance);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCCountry.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCCountry.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCCountry.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCCountry.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+/**
+ * @author <A HREF="mailto:pinaki.poddar@gmail.com>Pinaki Poddar</A>
+ */
+@Entity
+public class PCCountry {
+
+ private String code;
+ private String name;
+
+ protected PCCountry() {
+ super();
+ }
+
+ public PCCountry(String name, String code) {
+ setName(name);
+ setCode(code);
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public static Object reflect(PCCountry instance, String name) {
+ if (instance == null)
+ return null;
+ try {
+ return PCCountry.class.getDeclaredField(name).get(instance);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCDepartment.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCDepartment.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCDepartment.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCDepartment.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+
+import org.apache.openjpa.persistence.FetchAttribute;
+import org.apache.openjpa.persistence.FetchGroup;
+import org.apache.openjpa.persistence.FetchGroups;
+
+/**
+ * @author <A HREF="mailto:pinaki.poddar@gmail.com>Pinaki Poddar</A>
+ */
+@Entity
+@FetchGroups({
+@FetchGroup(name = "department.employees",
+ attributes = @FetchAttribute(name = "employees")),
+@FetchGroup(name = "department.company",
+ attributes = @FetchAttribute(name = "company"))
+ })
+public class PCDepartment {
+
+ private String name;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+ private PCCompany company;
+
+ @ManyToMany(cascade = CascadeType.PERSIST)
+ private Set<PCEmployee> employees;
+
+ public PCDepartment() {
+ super();
+ }
+
+ public PCDepartment(String name) {
+ super();
+ setName(name);
+ }
+
+ public PCCompany getCompany() {
+ return company;
+ }
+
+ public void setCompany(PCCompany company) {
+ this.company = company;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Set getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees(Set employees) {
+ this.employees = employees;
+ }
+
+ public void addEmployee(PCEmployee emp) {
+ if (employees == null)
+ employees = new HashSet();
+ employees.add(emp);
+ emp.setDepartment(this);
+ }
+
+ public boolean contains(PCEmployee emp) {
+ return employees != null && employees.contains(emp);
+ }
+
+ public static Object reflect(PCDepartment instance, String name) {
+ if (instance == null)
+ return null;
+ try {
+ return PCDepartment.class.getDeclaredField(name).get(instance);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCDirectory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCDirectory.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCDirectory.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCDirectory.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+
+import org.apache.openjpa.persistence.FetchAttribute;
+import org.apache.openjpa.persistence.FetchGroup;
+import org.apache.openjpa.persistence.FetchGroups;
+
+/**
+ * @author <A HREF="mailto:pinaki.poddar@gmail.com>Pinaki Poddar</A>
+ */
+@Entity
+@FetchGroups({
+@FetchGroup(name = "name+parent+grandparent", attributes = {
+@FetchAttribute(name = "_name"),
+@FetchAttribute(name = "_parent", recursionDepth = 2)
+ }),
+@FetchGroup(name = "name+parent+grandparent+greatgrandparent", attributes = {
+@FetchAttribute(name = "_name"),
+@FetchAttribute(name = "_parent", recursionDepth = 3)
+ }),
+@FetchGroup(name = "name+parent", attributes = {
+@FetchAttribute(name = "_name"),
+@FetchAttribute(name = "_parent")
+ }),
+@FetchGroup(name = "allparents", attributes = {
+@FetchAttribute(name = "_name"),
+@FetchAttribute(name = "_parent", recursionDepth = -1)
+ }),
+@FetchGroup(name = "name", attributes = @FetchAttribute(name = "_name"))
+ })
+public class PCDirectory {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private int id;
+
+ private String _name;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+ private PCDirectory _parent;
+
+ @ManyToMany(cascade = CascadeType.PERSIST)
+ private Set<PCDirectory> _children;
+
+ @ManyToMany(cascade = CascadeType.PERSIST)
+ private Set<PCFile> _files;
+
+ /**
+ *
+ */
+ public PCDirectory() {
+ super();
+ }
+
+ public PCDirectory(String name) {
+ super();
+ _name = name;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public PCDirectory getParent() {
+ return _parent;
+ }
+
+ public Set getChildren() {
+ return _children;
+ }
+
+ public Set getFiles() {
+ return _files;
+ }
+
+ public void add(PCDirectory dir) {
+ if (dir == null)
+ throw new NullPointerException("null directory");
+ if (dir.getParent() != null && dir.getParent() != this)
+ throw new IllegalArgumentException(dir + " has a different parent");
+ if (_children == null)
+ _children = new HashSet();
+ _children.add(dir);
+ dir._parent = this;
+ }
+
+ public PCFile add(String name) {
+ if (name == null)
+ throw new NullPointerException("null file");
+ PCFile file = new PCFile(this, name);
+ if (_files == null)
+ _files = new HashSet();
+ if (_files.contains(file))
+ throw new IllegalArgumentException("duplicate file" + file);
+ _files.add(file);
+ return file;
+ }
+
+ public boolean isChild(PCDirectory dir, boolean recurse) {
+ if (_children == null)
+ return false;
+
+ if (_children.contains(dir))
+ return true;
+ if (recurse) {
+ Iterator i = _children.iterator();
+ while (i.hasNext()) {
+ PCDirectory child = (PCDirectory) i.next();
+ if (child.isChild(dir, recurse))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isChild(PCFile file, boolean recurse) {
+ if (_files != null && _files.contains(file))
+ return true;
+
+ if (_children == null)
+ return false;
+
+ if (recurse) {
+ Iterator i = _children.iterator();
+ while (i.hasNext()) {
+ PCDirectory child = (PCDirectory) i.next();
+ if (child.isChild(file, recurse))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static Object reflect(PCDirectory instance, String name) {
+ if (instance == null)
+ return null;
+ try {
+ return PCDirectory.class.getDeclaredField(name).get(instance);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCEmployee.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCEmployee.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCEmployee.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCEmployee.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.ManyToOne;
+
+import org.apache.openjpa.persistence.FetchAttribute;
+import org.apache.openjpa.persistence.FetchGroup;
+
+/**
+ * @author <A HREF="mailto:pinaki.poddar@gmail.com>Pinaki Poddar</A>
+ */
+@Entity
+@FetchGroup(name = "employee.department",
+ attributes = @FetchAttribute(name = "department"))
+public class PCEmployee extends PCPerson {
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+ private PCDepartment department;
+
+ protected PCEmployee() {
+ super();
+ }
+
+ public PCEmployee(String name) {
+ super(name);
+ }
+
+ public PCDepartment getDepartment() {
+ return department;
+ }
+
+ public void setDepartment(PCDepartment department) {
+ this.department = department;
+ }
+
+ public static Object reflect(PCEmployee instance, String name) {
+ if (instance == null)
+ return null;
+ try {
+ return PCEmployee.class.getDeclaredField(name).get(instance);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCFile.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCFile.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCFile.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCFile.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+/**
+ * @author <A HREF="mailto:pinaki.poddar@gmail.com>Pinaki Poddar</A>
+ */
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.ManyToOne;
+
+@Entity
+public class PCFile {
+
+ private String _name;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+ private PCDirectory _dir;
+
+ /**
+ *
+ */
+ protected PCFile() {
+ super();
+ }
+
+ PCFile(PCDirectory dir, String name) {
+ super();
+ if (dir == null)
+ throw new NullPointerException("null directory");
+ if (name == null || name.trim().length() == 0)
+ throw new NullPointerException("null name");
+
+ _dir = dir;
+ _name = name;
+ }
+
+ public PCDirectory getDir() {
+ return _dir;
+ }
+
+ public String getName() {
+ return _name;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCPerson.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCPerson.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCPerson.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PCPerson.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+
+import org.apache.openjpa.persistence.FetchAttribute;
+import org.apache.openjpa.persistence.FetchGroup;
+import org.apache.openjpa.persistence.FetchGroups;
+
+/**
+ * @author <A HREF="mailto:pinaki.poddar@gmail.com>Pinaki Poddar</A>
+ */
+@Entity
+@FetchGroups({
+@FetchGroup(name = "detail+children-names", fetchGroups = "detail"),
+@FetchGroup(name = "detail", fetchGroups = "default",
+ attributes = @FetchAttribute(name = "address")),
+@FetchGroup(name = "detail+children-list", fetchGroups = "detail",
+ attributes = @FetchAttribute(name = "children")),
+@FetchGroup(name = "person.address",
+ attributes = @FetchAttribute(name = "address"))
+ })
+public class PCPerson {
+
+ private String name;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+ private PCAddress address;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+ private PCPerson parent;
+
+ @ManyToMany(cascade = CascadeType.PERSIST)
+ private Set<PCPerson> children;
+
+ protected PCPerson() {
+ super();
+ }
+
+ public PCPerson(String name) {
+ setName(name);
+ }
+
+ public PCAddress getAddress() {
+ return address;
+ }
+
+ public void setAddress(PCAddress address) {
+ this.address = address;
+ }
+
+ public Set getChildren() {
+ return children;
+ }
+
+ public void setChildren(Set children) {
+ this.children = children;
+ }
+
+ public void addChildren(PCPerson child) {
+ if (children == null)
+ children = new HashSet();
+ children.add(child);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public PCPerson getParent() {
+ return parent;
+ }
+
+ public void setParent(PCPerson parent) {
+ this.parent = parent;
+ }
+
+ public static Object reflect(PCPerson instance, String name) {
+ if (instance == null)
+ return null;
+ try {
+ return PCPerson.class.getDeclaredField(name).get(instance);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PersistenceAware.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PersistenceAware.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PersistenceAware.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/PersistenceAware.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.kernel.common.apps;
+
+import javax.persistence.Entity;
+
+/**
+ * <p>A persistence-aware type that should be enhanced.</p>
+ *
+ * @author Abe White
+ */
+@Entity
+public class PersistenceAware {
+
+ public static String getTransString(RuntimeTest1 rt) {
+ return rt.transString;
+ }
+
+ public static void setTransString(RuntimeTest1 rt, String value) {
+ rt.transString = value;
+ }
+
+ public static String getModTransString(ModRuntimeTest1 rt) {
+ return rt.transString;
+ }
+
+ public static void setModTransString(ModRuntimeTest1 rt, String value) {
+ rt.transString = value;
+ }
+}