You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by fa...@apache.org on 2008/12/08 22:22:59 UTC

svn commit: r724490 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/a...

Author: faywang
Date: Mon Dec  8 13:22:58 2008
New Revision: 724490

URL: http://svn.apache.org/viewvc?rev=724490&view=rev
Log:
OPENJPA-792: MappedSuperClass problem. Commit on behalf of 
Sandhya Turaga.

Added:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party1.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PartyId.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site1.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store1.java
Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/META-INF/persistence.xml

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java?rev=724490&r1=724489&r2=724490&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java Mon Dec  8 13:22:58 2008
@@ -2486,14 +2486,23 @@
             // new ObjectId (cls, oid)
             code.anew().setType(ObjectId.class);
             code.dup();
-            code.classconstant().setClass(getType(_meta));
+            if(_meta.isEmbeddedOnly()) {
+                code.aload().setThis();
+                code.invokevirtual().setMethod(Object.class, "getClass", Class.class, null);
+            }else
+                code.classconstant().setClass(getType(_meta));
         }
 
         // new <oid class> ();
         code.anew().setType(oidType);
         code.dup();
-        if (_meta.isOpenJPAIdentity() || (obj && usesClsString == Boolean.TRUE))
-            code.classconstant().setClass(getType(_meta));
+        if (_meta.isOpenJPAIdentity() || (obj && usesClsString == Boolean.TRUE)) {
+            if(_meta.isEmbeddedOnly()) {
+                code.aload().setThis();
+                code.invokevirtual().setMethod(Object.class, "getClass", Class.class, null);
+            }else
+                code.classconstant().setClass(getType(_meta));
+        }
         if (obj) {
             code.aload().setParam(0);
             code.checkcast().setType(String.class);

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java?rev=724490&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestMappedSuperClass.java Mon Dec  8 13:22:58 2008
@@ -0,0 +1,174 @@
+/*
+ * 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.annotations;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.PartyId;
+import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Site;
+import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Site1;
+import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Store;
+import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Store1;
+
+public class TestMappedSuperClass extends AnnotationTestCase {
+
+    public static Long pkey = new Long(1500);
+    public static String pstr = "TestParty";
+    public static int ikey = 1501;
+    public static PartyId pid = new PartyId(pstr, ikey);
+    
+    public TestMappedSuperClass(String name) {
+        super(name, "annotationMappedSuperclassApp");
+    }
+
+    public void setUp() {
+        deleteAll(Store.class);
+        deleteAll(Site.class);
+        deleteAll(Site1.class);
+        deleteAll(Store1.class);
+    }
+
+    public void testMappedSuperClassSameKeys() {
+        createSite();
+        createStore();
+    }
+
+    public void testMappedSuperClassIdClass() {
+        createSite1();
+        createStore1();
+    }
+
+    private void createSite() {
+        OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager();
+        boolean persistSuccess = true;
+        try{
+            startTx(em);
+    
+            Site s = new Site();
+            s.setPartyId(pkey);
+            s.setSiteName("San Jose");
+            s.setSiteDescription("San Jose site");
+            s.setStatus("2");
+            s.setArchiveStatus("2");
+            s.setCreateDate(new Date());
+    
+            em.persist(s);
+    
+            endTx(em);
+        }catch(Exception e) {
+            persistSuccess = false;
+        }finally{
+            assertTrue(persistSuccess);
+        }
+        endEm(em);
+    }
+
+    private void createStore() {
+        OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager();
+        boolean persistSuccess = true;
+        try{
+            startTx(em);
+    
+            Site site = em.find(Site.class, pkey);
+    
+            Store store = new Store();
+            store.setPartyId(pkey);
+            store.setStoreDescription("storeDescription");
+            store.setStoreName("storeName");
+            store.setStatus("1");
+            store.setArchiveStatus("1");
+            store.setCreateDate(new Date());
+            store.setSiteId(site.getPartyId());
+            store.setSite(site);
+    
+            List<Store> stores = new ArrayList<Store>();
+            stores.add(store);
+            site.setStores(stores);
+    
+            em.persist(store);
+            endTx(em);
+        }catch(Exception e) {
+            persistSuccess = false;
+        }finally {
+            assertTrue(persistSuccess);
+        }
+        endEm(em);
+    }
+
+    private void createSite1() {
+        OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager();
+        boolean persistSuccess = true;
+        try{
+            startTx(em);
+    
+            Site1 s = new Site1();
+            s.setId(ikey);
+            s.setPartyName(pstr);
+            s.setSiteName("San Jose");
+            s.setSiteDescription("San Jose site");
+            s.setStatus("2");
+            s.setArchiveStatus("2");
+            s.setCreateDate(new Date());
+    
+            em.persist(s);
+    
+            endTx(em);
+        }catch(Exception e) {
+            persistSuccess = false;
+        }finally {
+            assertTrue(persistSuccess);
+        }
+        endEm(em);
+    }
+
+    private void createStore1() {
+        OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager();
+        boolean persistSuccess = true;
+        try{
+            startTx(em);
+    
+            Site1 site = em.find(Site1.class, pid);
+    
+            Store1 store = new Store1();
+            store.setId(ikey);
+            store.setPartyName(pstr);
+            store.setStoreDescription("storeDescription");
+            store.setStoreName("storeName");
+            store.setStatus("1");
+            store.setArchiveStatus("1");
+            store.setCreateDate(new Date());
+            store.setSite(site);
+    
+            List<Store1> stores = new ArrayList<Store1>();
+            stores.add(store);
+            site.setStores(stores);
+    
+            em.persist(store);
+            endTx(em);
+    }catch(Exception e) {
+        persistSuccess = false;
+    }finally {
+        assertTrue(persistSuccess);
+    }
+        endEm(em);
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party.java?rev=724490&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party.java Mon Dec  8 13:22:58 2008
@@ -0,0 +1,71 @@
+/*
+ * 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.annotations.common.apps.annotApp.annotype;
+
+import java.util.Date;
+
+import javax.persistence.Id;
+
+@javax.persistence.MappedSuperclass
+public class Party {
+
+    @Id
+    protected Long PartyId;
+
+    protected String Status;
+    protected String ArchiveStatus;
+    protected Date CreateDate;
+
+
+    public Long getPartyId() {
+        return this.PartyId;
+    }
+
+    public void setPartyId(Long id){
+        this.PartyId = id;
+    }
+
+    public void setArchiveStatus(String s){
+        this.ArchiveStatus = s;
+
+    }
+
+    public void setStatus(String s) {
+        this.Status = s;
+    }
+
+
+    public String getStatus() {
+        return this.Status;
+    }
+
+
+    public String getArchiveStatus() {
+        return this.ArchiveStatus;
+    }
+
+    public void setCreateDate(Date d) {
+        this.CreateDate = d;
+    }
+
+
+    public Date getCreateDate() {
+        return this.CreateDate;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party1.java?rev=724490&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Party1.java Mon Dec  8 13:22:58 2008
@@ -0,0 +1,85 @@
+/*
+ * 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.annotations.common.apps.annotApp.annotype;
+
+import java.util.Date;
+
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+@javax.persistence.MappedSuperclass
+@Inheritance(strategy=InheritanceType.JOINED)
+@IdClass(PartyId.class)
+public class Party1 {
+
+    @Id
+    protected int id;
+
+    @Id
+    protected String partyName;
+
+    protected String Status;
+    protected String ArchiveStatus;
+    protected Date CreateDate;
+
+    public Party1(){}
+
+    public String getPartyName() {
+        return this.partyName;
+    }
+
+    public void setPartyName(String name) {
+        this.partyName = name;
+    }
+
+    public int getId() {
+        return this.id;
+    }
+
+    public void setId(int id){
+        this.id = id;
+    }
+
+    public void setArchiveStatus(String s){
+        this.ArchiveStatus = s;
+    }
+
+    public void setStatus(String s) {
+        this.Status = s;
+    }
+
+    public String getStatus() {
+        return this.Status;
+    }
+
+
+    public String getArchiveStatus() {
+        return this.ArchiveStatus;
+    }
+
+    public void setCreateDate(Date d) {
+        this.CreateDate = d;
+    }
+
+    public Date getCreateDate() {
+        return this.CreateDate;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PartyId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PartyId.java?rev=724490&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PartyId.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/PartyId.java Mon Dec  8 13:22:58 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.annotations.common.apps.annotApp.annotype;
+
+import java.io.Serializable;
+
+public class PartyId implements Serializable{
+
+    private static final long serialVersionUID = 1L;
+    private String partyName;
+    private int id;
+
+    public PartyId() {}
+
+    public  PartyId(String partyName, int id) {
+        this.partyName = partyName;
+        this.id = id;
+    }
+
+    public String getPartyName() {
+        return this.partyName;
+    }
+
+    public int getId() {
+        return this.id;
+    }
+
+    public boolean equals(Object o) {
+        return (o instanceof PartyId) &&
+            partyName.equals(((PartyId)o).getPartyName()) &&
+            id == (((PartyId)o).getId());
+    }
+
+    public int hashCode() {
+        return partyName.hashCode() + id;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site.java?rev=724490&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site.java Mon Dec  8 13:22:58 2008
@@ -0,0 +1,64 @@
+/*
+ * 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.annotations.common.apps.annotApp.annotype;
+
+import java.util.List;
+import javax.persistence.Entity;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.FetchType;
+import javax.persistence.CascadeType;
+
+@Entity
+@Table(name = "Site")
+public class Site  extends Party implements java.io.Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String SiteName;
+    private String SiteDescription;
+
+    @OneToMany(mappedBy="site",  cascade=CascadeType.ALL, fetch=FetchType.LAZY, 
+            targetEntity=Store.class)
+     private List<Store> stores;
+
+
+    public List<Store> getStores() {
+        return stores;
+    }
+
+    public void setStores(List<Store> storeList){
+        this.stores = storeList;
+    }
+    public void setSiteName(String s) {
+        this.SiteName = s;
+    }
+
+    public String getSiteName(){
+        return this.SiteName;
+    }
+
+    public void setSiteDescription(String s) {
+        this.SiteDescription = s;
+    }
+
+    public String getSiteDescription() {
+        return this.SiteDescription;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site1.java?rev=724490&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Site1.java Mon Dec  8 13:22:58 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.annotations.common.apps.annotApp.annotype;
+
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.FetchType;
+import javax.persistence.CascadeType;
+
+@Entity
+@Table(name = "Site1")
+public class Site1  extends Party1 implements java.io.Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String SiteName;
+    private String SiteDescription;
+
+    @OneToMany(mappedBy="site",  cascade=CascadeType.ALL, fetch=FetchType.LAZY, 
+            targetEntity=Store1.class)
+    private List<Store1> stores;
+
+
+    public List<Store1> getStores() {
+        return stores;
+    }
+
+    public void setStores(List<Store1> storeList){
+        this.stores = storeList;
+    }
+
+    public void setSiteName(String s) {
+        this.SiteName = s;
+    }
+
+    public String getSiteName(){
+        return this.SiteName;
+    }
+
+    public void setSiteDescription(String s) {
+        this.SiteDescription = s;
+    }
+
+    public String getSiteDescription() {
+        return this.SiteDescription;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store.java?rev=724490&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store.java Mon Dec  8 13:22:58 2008
@@ -0,0 +1,79 @@
+/*
+ * 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.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "Store")
+public class Store extends Party implements java.io.Serializable {
+
+    private static final long serialVersionUID = 1L;
+    private String StoreName;
+    private String StoreDescription;
+
+    @ManyToOne( fetch = FetchType.LAZY,  cascade = CascadeType.ALL, 
+            targetEntity=Site.class)
+    @JoinColumn(name = "Store.SiteId",
+            referencedColumnName="site.PartyId", nullable = false, 
+            insertable = true, updatable = true)
+    private Site site;
+
+    private Long SiteId;
+
+    public Site getSite() {
+        return site;
+    }
+
+    public void setSite(Site s) {
+        this.site = s;
+
+    }
+
+    public void setStoreName(String s) {
+        this.StoreName = s;
+    }
+
+    public String getStoreName() {
+        return this.StoreName;
+    }
+
+    public void setStoreDescription(String s){
+        this.StoreDescription = s;
+    }
+
+    public String getStoreDescription(){
+        return this.StoreDescription;
+    } 
+
+
+    public void setSiteId(Long pid) {
+        this.SiteId = pid;
+    }
+
+    public Long getSiteId() {
+        return this.SiteId;
+    }
+
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store1.java?rev=724490&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/Store1.java Mon Dec  8 13:22:58 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.annotations.common.apps.annotApp.annotype;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "Store1")
+public class Store1 extends Party1 implements java.io.Serializable {
+
+    private static final long serialVersionUID = 1L;
+    private String StoreName;
+    private String StoreDescription;
+
+    @ManyToOne( fetch = FetchType.LAZY,  cascade = CascadeType.ALL, 
+            targetEntity=Site1.class)
+    private Site1 site;
+
+    public Site1 getSite() {
+        return site;
+    }
+
+    public void setSite(Site1 s) {
+        this.site = s;
+
+    }
+
+    public void setStoreName(String s) {
+        this.StoreName = s;
+    }
+
+    public String getStoreName() {
+        return this.StoreName;
+    }
+
+    public void setStoreDescription(String s){
+        this.StoreDescription = s;
+    }
+
+    public String getStoreDescription(){
+        return this.StoreDescription;
+    } 
+}

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/META-INF/persistence.xml?rev=724490&r1=724489&r2=724490&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/META-INF/persistence.xml (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/annotations/common/apps/annotApp/annotype/META-INF/persistence.xml Mon Dec  8 13:22:58 2008
@@ -44,5 +44,11 @@
 		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.EmbeddedIdClass</class>
 		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.EmbeddableSuper</class>
 		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.TxRollbackEntity</class>
+		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Party</class>
+		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Store</class>
+		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Site</class>
+		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Party1</class>
+		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Store1</class>
+		<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.Site1</class>
 	</persistence-unit>
 </persistence>