mirror of https://github.com/apache/openjpa.git
OPENJPA-792: MappedSuperClass problem. Commit on behalf of
Sandhya Turaga. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@724490 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e78a1bc079
commit
9946b6c19b
|
@ -2486,14 +2486,23 @@ public class PCEnhancer {
|
||||||
// new ObjectId (cls, oid)
|
// new ObjectId (cls, oid)
|
||||||
code.anew().setType(ObjectId.class);
|
code.anew().setType(ObjectId.class);
|
||||||
code.dup();
|
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> ();
|
// new <oid class> ();
|
||||||
code.anew().setType(oidType);
|
code.anew().setType(oidType);
|
||||||
code.dup();
|
code.dup();
|
||||||
if (_meta.isOpenJPAIdentity() || (obj && usesClsString == Boolean.TRUE))
|
if (_meta.isOpenJPAIdentity() || (obj && usesClsString == Boolean.TRUE)) {
|
||||||
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));
|
||||||
|
}
|
||||||
if (obj) {
|
if (obj) {
|
||||||
code.aload().setParam(0);
|
code.aload().setParam(0);
|
||||||
code.checkcast().setType(String.class);
|
code.checkcast().setType(String.class);
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.EmbeddedIdClass</class>
|
||||||
<class>org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.EmbeddableSuper</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.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-unit>
|
||||||
</persistence>
|
</persistence>
|
||||||
|
|
Loading…
Reference in New Issue