mirror of https://github.com/apache/openjpa.git
OPENJPA-1115 Fixed many naming collisions in delimited id tests. Corrected bug in schema group that broke fully qualified sequence names.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@900955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
00c44aba43
commit
245bb82d34
|
@ -306,7 +306,7 @@ public class SchemaGroup
|
|||
* given sequence that may have come from another schema group.
|
||||
*/
|
||||
public Sequence findSequence(Sequence seq) {
|
||||
return findSequence(QualifiedDBIdentifier.getPath(seq.getIdentifier()));
|
||||
return findSequence(seq.getQualifiedPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.apache.openjpa.persistence.delimited.identifiers;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ColumnResult;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.Entity;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class EntityA {
|
|||
private Map<String, String> collectionMap = new HashMap<String, String>();
|
||||
|
||||
@ElementCollection
|
||||
@MapKeyColumn(name="map key", columnDefinition="varchar(20)", table="map key table")
|
||||
@MapKeyColumn(name="map key", columnDefinition="varchar(20)", table="m ktbl")
|
||||
private Map<String, String> delimCollectionMap =
|
||||
new HashMap<String, String>();
|
||||
|
||||
|
|
|
@ -58,12 +58,12 @@ public class EntityC {
|
|||
private EntityD2 entityD2;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name="\"map join table\"", schema="\"delim id\"")
|
||||
@JoinTable(name="\"m jtbl\"", schema="\"delim id\"")
|
||||
@MapKeyJoinColumn(name="map_ed3", referencedColumnName="\"entityD3 id\"")
|
||||
Map<EntityD3,EntityD4> map = new HashMap<EntityD3,EntityD4>();
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name="\"map2 join table\"", schema="\"delim id\"")
|
||||
@JoinTable(name="\"m2 jtbl\"", schema="\"delim id\"")
|
||||
@MapKeyJoinColumn(name="\"map ed4\"",
|
||||
referencedColumnName="\"entityD4 id\"")
|
||||
Map<EntityD4,EntityD3> map2 = new HashMap<EntityD4,EntityD3>();
|
||||
|
|
|
@ -63,7 +63,7 @@ public class EntityF {
|
|||
@ElementCollection
|
||||
// CollectionTable with default name generation
|
||||
@CollectionTable
|
||||
private Set<String> collectionSet = new HashSet<String>();
|
||||
private Set<String> cSet = new HashSet<String>();
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(name="\"collectionDelimSet\"", schema="\"delim id\"")
|
||||
|
@ -71,15 +71,15 @@ public class EntityF {
|
|||
|
||||
@ElementCollection
|
||||
// MapKeyColumn with default name generation
|
||||
@MapKeyColumn
|
||||
private Map<String, String> collectionMap = new HashMap<String, String>();
|
||||
@MapKeyColumn
|
||||
private Map<String, String> cMap = new HashMap<String, String>();
|
||||
|
||||
@ElementCollection
|
||||
// Note: Delimited column definition is not supported on some DBs, so
|
||||
// it is not delimited here
|
||||
// TODO: create a separate entity and conditionally run the test on a supported DB
|
||||
@MapKeyColumn(name="\"mapKey\"", columnDefinition="varchar(20)", table="\"delim collection map\"")
|
||||
private Map<String, String> delimCollectionMap =
|
||||
@MapKeyColumn(name="\"mapKey\"", columnDefinition="varchar(20)", table="\"d colmap\"")
|
||||
private Map<String, String> dcMap =
|
||||
new HashMap<String, String>();
|
||||
|
||||
public EntityF(String name) {
|
||||
|
@ -143,18 +143,18 @@ public class EntityF {
|
|||
* @return the collectionSet
|
||||
*/
|
||||
public Set<String> getCollectionSet() {
|
||||
return collectionSet;
|
||||
return cSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param collectionSet the collectionSet to set
|
||||
*/
|
||||
public void setCollectionSet(Set<String> collectionSet) {
|
||||
this.collectionSet = collectionSet;
|
||||
this.cSet = collectionSet;
|
||||
}
|
||||
|
||||
public void addCollectionSet(String item) {
|
||||
collectionSet.add(item);
|
||||
cSet.add(item);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,35 +179,35 @@ public class EntityF {
|
|||
* @return the collectionMap
|
||||
*/
|
||||
public Map<String, String> getCollectionMap() {
|
||||
return collectionMap;
|
||||
return cMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param collectionMap the collectionMap to set
|
||||
*/
|
||||
public void setCollectionMap(Map<String, String> collectionMap) {
|
||||
this.collectionMap = collectionMap;
|
||||
this.cMap = collectionMap;
|
||||
}
|
||||
|
||||
public void addCollectionMap(String key, String value) {
|
||||
collectionMap.put(key, value);
|
||||
cMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the delimCollectionMap
|
||||
*/
|
||||
public Map<String, String> getDelimCollectionMap() {
|
||||
return delimCollectionMap;
|
||||
return dcMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param delimCollectionMap the delimCollectionMap to set
|
||||
*/
|
||||
public void setDelimCollectionMap(Map<String, String> delimCollectionMap) {
|
||||
this.delimCollectionMap = delimCollectionMap;
|
||||
this.dcMap = delimCollectionMap;
|
||||
}
|
||||
|
||||
public void addDelimCollectionMap(String key, String value) {
|
||||
delimCollectionMap.put(key, value);
|
||||
dcMap.put(key, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class EntityH {
|
|||
@ManyToMany
|
||||
@JoinTable(name="map4 join table", schema="delim id2")
|
||||
@MapKeyJoinColumn(name="map ei4",
|
||||
referencedColumnName="entityI4 id", table="map key join column")
|
||||
referencedColumnName="entityI4 id", table="mk j col")
|
||||
Map<EntityI4,EntityI3> map2 = new HashMap<EntityI4,EntityI3>();
|
||||
|
||||
public EntityH() {}
|
||||
|
|
|
@ -52,7 +52,8 @@ public class TestDelimIdResultSetAnnotations
|
|||
org.apache.openjpa.persistence.delimited.identifiers.Chevrolet.class,
|
||||
org.apache.openjpa.persistence.delimited.identifiers.Car2.class,
|
||||
org.apache.openjpa.persistence.delimited.identifiers.Pontiac2.class,
|
||||
org.apache.openjpa.persistence.delimited.identifiers.Chevrolet2.class);
|
||||
org.apache.openjpa.persistence.delimited.identifiers.Chevrolet2.class,
|
||||
DROP_TABLES);
|
||||
assertNotNull(emf);
|
||||
|
||||
em = emf.createEntityManager();
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
|
||||
import javax.persistence.Query;
|
||||
|
||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
|
||||
import org.apache.openjpa.persistence.test.SQLListenerTestCase;
|
||||
|
|
|
@ -53,8 +53,8 @@ public class TestManualDelimIdResultSetAnnotations
|
|||
org.apache.openjpa.persistence.delimited.identifiers.Cat.class,
|
||||
org.apache.openjpa.persistence.delimited.identifiers.Animal2.class,
|
||||
org.apache.openjpa.persistence.delimited.identifiers.Dog2.class,
|
||||
org.apache.openjpa.persistence.delimited.identifiers.Cat2.class
|
||||
);
|
||||
org.apache.openjpa.persistence.delimited.identifiers.Cat2.class,
|
||||
DROP_TABLES);
|
||||
assertNotNull(emf);
|
||||
|
||||
em = emf.createEntityManager();
|
||||
|
|
|
@ -4,9 +4,7 @@ import java.util.List;
|
|||
|
||||
import javax.persistence.Query;
|
||||
|
||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||
import org.apache.openjpa.jdbc.sql.DB2Dictionary;
|
||||
import org.apache.openjpa.jdbc.sql.DBDictionary;
|
||||
import org.apache.openjpa.jdbc.sql.DerbyDictionary;
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||
/*
|
||||
|
|
|
@ -36,36 +36,36 @@ import javax.persistence.SecondaryTable;
|
|||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="\"entity c\"")
|
||||
@SecondaryTable(name="\"sec join table\"",
|
||||
pkJoinColumns=@PrimaryKeyJoinColumn(name="\"entity c\"",
|
||||
referencedColumnName="\"c id\""))
|
||||
@Table(name="\"nsentity c\"")
|
||||
@SecondaryTable(name="\"nssec join table\"",
|
||||
pkJoinColumns=@PrimaryKeyJoinColumn(name="\"nsentity c\"",
|
||||
referencedColumnName="\"nsc id\""))
|
||||
public class EntityC {
|
||||
@Id
|
||||
@Column(name="\"c id\"")
|
||||
@Column(name="\"nsc id\"")
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
@Column(table="\"sec join table\"")
|
||||
@Column(table="\"nssec join table\"")
|
||||
private String secName;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name="\"c d\"")
|
||||
@JoinTable(name="\"nsc d\"")
|
||||
private Collection<EntityD> entityDs = new HashSet<EntityD>();
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name="\"entd2 id\"", referencedColumnName="\"entityD2 id\"")
|
||||
@JoinColumn(name="\"nsentd2 id\"", referencedColumnName="\"nsentityD2 id\"")
|
||||
private EntityD2 entityD2;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name="\"map join table\"")
|
||||
@MapKeyJoinColumn(name="map_ed3", referencedColumnName="\"entityD3 id\"")
|
||||
@JoinTable(name="\"nsm ndjtab\"")
|
||||
@MapKeyJoinColumn(name="nsmap_ed3", referencedColumnName="\"nsentityD3 id\"")
|
||||
Map<EntityD3,EntityD4> map = new HashMap<EntityD3,EntityD4>();
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name="\"map2 join table\"")
|
||||
@MapKeyJoinColumn(name="\"map ed4\"",
|
||||
referencedColumnName="\"entityD4 id\"")
|
||||
@JoinTable(name="\"nsm2 ndjtbl\"")
|
||||
@MapKeyJoinColumn(name="\"nsmap ed4\"",
|
||||
referencedColumnName="\"nsentityD4 id\"")
|
||||
Map<EntityD4,EntityD3> map2 = new HashMap<EntityD4,EntityD3>();
|
||||
|
||||
public EntityC() {}
|
||||
|
|
|
@ -27,7 +27,7 @@ import javax.persistence.ManyToMany;
|
|||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="\"entity d\"")
|
||||
@Table(name="\"nsentity d\"")
|
||||
public class EntityD {
|
||||
@Id
|
||||
private int id;
|
||||
|
|
|
@ -26,10 +26,10 @@ import javax.persistence.PrimaryKeyJoinColumn;
|
|||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="\"entity d2\"")
|
||||
@Table(name="\"nsentity d2\"")
|
||||
public class EntityD2 {
|
||||
@Id
|
||||
@Column(name="\"entityD2 id\"")
|
||||
@Column(name="\"nsentityD2 id\"")
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="\"entity d3\"")
|
||||
@Table(name="\"nsentity d3\"")
|
||||
public class EntityD3 {
|
||||
@Id
|
||||
@Column(name="\"entityD3 id\"")
|
||||
@Column(name="\"nsentityD3 id\"")
|
||||
int id;
|
||||
String name;
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="\"entity d4\"")
|
||||
@Table(name="\"nsentity d4\"")
|
||||
public class EntityD4 {
|
||||
@Id
|
||||
@Column(name="\"entityD4 id\"")
|
||||
@Column(name="\"nsentityD4 id\"")
|
||||
int id;
|
||||
String name;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="\"primary entityE\"")
|
||||
@Table(name="\"nsprimary entityE\"")
|
||||
public class EntityE {
|
||||
@Id
|
||||
@SequenceGenerator(name="entityE_seq_gen_name",
|
||||
|
@ -35,7 +35,7 @@ public class EntityE {
|
|||
@GeneratedValue(strategy=GenerationType.SEQUENCE,
|
||||
generator="entityE_seq_gen_name")
|
||||
private int id;
|
||||
@Column(name="e_name")
|
||||
@Column(name="nse_name")
|
||||
private String name;
|
||||
|
||||
public EntityE(String name) {
|
||||
|
|
|
@ -37,47 +37,47 @@ import javax.persistence.TableGenerator;
|
|||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
@Entity
|
||||
@Table(name="\"primary entityF\"",
|
||||
@Table(name="\"nsprimary entityF\"",
|
||||
uniqueConstraints=
|
||||
@UniqueConstraint(columnNames={"\"f name\"", "f_nonDelimName"}))
|
||||
@SecondaryTable(name="\"secondary entityF\"",
|
||||
@UniqueConstraint(columnNames={"\"nsf name\"", "nsf_nonDelimName"}))
|
||||
@SecondaryTable(name="\"nssecondary entityF\"",
|
||||
uniqueConstraints=
|
||||
@UniqueConstraint(name="\"sec_unq\"",
|
||||
columnNames={"\"secondary name\""}))
|
||||
@UniqueConstraint(name="\"nssec_unq\"",
|
||||
columnNames={"\"nssecondary name\""}))
|
||||
public class EntityF {
|
||||
@TableGenerator(name = "f_id_gen", table = "\"f_id_gen\"",
|
||||
pkColumnName = "\"gen_pk\"", valueColumnName = "\"gen_value\"")
|
||||
@TableGenerator(name = "f_id_gen", table = "\"nsf_id_gen\"",
|
||||
pkColumnName = "\"nsgen_pk\"", valueColumnName = "\"nsgen_value\"")
|
||||
@GeneratedValue(strategy = GenerationType.TABLE, generator = "f_id_gen")
|
||||
@Id
|
||||
private int id;
|
||||
// Note: Delimited columnDefinition is not supported on some DBs
|
||||
// TODO: copy into a separate entity and conditionally run a different test
|
||||
@Column(name="\"f name\"", columnDefinition="varchar(15)")
|
||||
@Column(name="\"nsf name\"", columnDefinition="varchar(15)")
|
||||
private String name;
|
||||
@Column(name="f_nonDelimName")
|
||||
@Column(name="nsf_nonDelimName")
|
||||
private String nonDelimName;
|
||||
@Column(name="\"secondary name\"", table="\"secondary entityF\"")
|
||||
@Column(name="\"nssecondary name\"", table="\"nssecondary entityF\"")
|
||||
private String secName;
|
||||
|
||||
@ElementCollection
|
||||
// CollectionTable with default name generation
|
||||
@CollectionTable
|
||||
private Set<String> collectionSet = new HashSet<String>();
|
||||
private Set<String> nscs = new HashSet<String>();
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(name="\"collectionDelimSet\"")
|
||||
private Set<String> collectionDelimSet = new HashSet<String>();
|
||||
@CollectionTable(name="\"nscDelSet\"")
|
||||
private Set<String> nscds = new HashSet<String>();
|
||||
|
||||
@ElementCollection
|
||||
// MapKeyColumn with default name generation
|
||||
@MapKeyColumn
|
||||
private Map<String, String> collectionMap = new HashMap<String, String>();
|
||||
private Map<String, String> nscollMap = new HashMap<String, String>();
|
||||
|
||||
@ElementCollection
|
||||
// Note: Delimited column definition is not supported on some DBs, so
|
||||
// it is not delimited here
|
||||
// TODO: create a separate entity and conditionally run the test on a supported DB
|
||||
@MapKeyColumn(name="\"mapKey\"", columnDefinition="varchar(20)", table="\"delim collection map\"")
|
||||
@MapKeyColumn(name="\"nsmap Key\"", columnDefinition="varchar(20)", table="\"nsd c map\"")
|
||||
private Map<String, String> delimCollectionMap =
|
||||
new HashMap<String, String>();
|
||||
|
||||
|
@ -142,54 +142,54 @@ public class EntityF {
|
|||
* @return the collectionSet
|
||||
*/
|
||||
public Set<String> getCollectionSet() {
|
||||
return collectionSet;
|
||||
return nscs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param collectionSet the collectionSet to set
|
||||
*/
|
||||
public void setCollectionSet(Set<String> collectionSet) {
|
||||
this.collectionSet = collectionSet;
|
||||
this.nscs = collectionSet;
|
||||
}
|
||||
|
||||
public void addCollectionSet(String item) {
|
||||
collectionSet.add(item);
|
||||
nscs.add(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the collectionNamedSet
|
||||
*/
|
||||
public Set<String> getCollectionDelimSet() {
|
||||
return collectionDelimSet;
|
||||
return nscds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param collectionNamedSet the collectionNamedSet to set
|
||||
*/
|
||||
public void setCollectionDelimSet(Set<String> collectionDelimSet) {
|
||||
this.collectionDelimSet = collectionDelimSet;
|
||||
this.nscds = collectionDelimSet;
|
||||
}
|
||||
|
||||
public void addCollectionDelimSet(String item) {
|
||||
this.collectionDelimSet.add(item);
|
||||
this.nscds.add(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the collectionMap
|
||||
*/
|
||||
public Map<String, String> getCollectionMap() {
|
||||
return collectionMap;
|
||||
return nscollMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param collectionMap the collectionMap to set
|
||||
*/
|
||||
public void setCollectionMap(Map<String, String> collectionMap) {
|
||||
this.collectionMap = collectionMap;
|
||||
this.nscollMap = collectionMap;
|
||||
}
|
||||
|
||||
public void addCollectionMap(String key, String value) {
|
||||
collectionMap.put(key, value);
|
||||
nscollMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,7 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="\"entity d4\"")
|
||||
@Table(name="\"nsentity d4\"")
|
||||
public class EntityG {
|
||||
@Id
|
||||
int id;
|
||||
|
|
|
@ -32,23 +32,17 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
|||
import org.apache.openjpa.persistence.test.AllowFailure;
|
||||
import org.apache.openjpa.persistence.test.SQLListenerTestCase;
|
||||
|
||||
@AllowFailure(message="Temporarily allowing this test to fail until cleanup " +
|
||||
"order issues are resolved.")
|
||||
public class TestNoSchemaManualDelimId extends SQLListenerTestCase {
|
||||
OpenJPAEntityManager em;
|
||||
EntityF entityF;
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
|
||||
// TODO: Delimiter support is currently limited to database that use
|
||||
// double quote as a delimiter.
|
||||
// Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase
|
||||
// is resolved.
|
||||
setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class);
|
||||
|
||||
setUnsupportedDatabases(MySQLDictionary.class);
|
||||
if (isTestsDisabled())
|
||||
return;
|
||||
|
||||
|
||||
super.setUp(
|
||||
org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityF.class,
|
||||
DROP_TABLES);
|
||||
|
@ -124,7 +118,7 @@ public class TestNoSchemaManualDelimId extends SQLListenerTestCase {
|
|||
private void queryCollection() {
|
||||
String query =
|
||||
"SELECT DISTINCT f " +
|
||||
"FROM EntityF f, IN(f.collectionDelimSet) s " +
|
||||
"FROM EntityF f, IN(f.nscds) s " +
|
||||
"WHERE s = 'aaa'";
|
||||
Query q = em.createQuery(query);
|
||||
List<EntityF> results = (List<EntityF>)q.getResultList();
|
||||
|
|
|
@ -26,8 +26,6 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
|||
import org.apache.openjpa.persistence.test.AllowFailure;
|
||||
import org.apache.openjpa.persistence.test.SQLListenerTestCase;
|
||||
|
||||
@AllowFailure(message="Temporarily allowing this test to fail until cleanup " +
|
||||
"order issues are resolved.")
|
||||
public class TestNoSchemaManualDelimIdSeqGen extends SQLListenerTestCase {
|
||||
OpenJPAEntityManager em;
|
||||
JDBCConfiguration conf;
|
||||
|
@ -39,11 +37,7 @@ public class TestNoSchemaManualDelimIdSeqGen extends SQLListenerTestCase {
|
|||
@Override
|
||||
public void setUp() throws Exception {
|
||||
|
||||
// TODO: Delimiter support is currently limited to database that use
|
||||
// double quote as a delimiter.
|
||||
// Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase
|
||||
// is resolved.
|
||||
setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class);
|
||||
setUnsupportedDatabases(MySQLDictionary.class);
|
||||
if (isTestsDisabled())
|
||||
return;
|
||||
|
||||
|
@ -104,9 +98,7 @@ public class TestNoSchemaManualDelimIdSeqGen extends SQLListenerTestCase {
|
|||
em.getTransaction().begin();
|
||||
em.persist(entityE);
|
||||
em.getTransaction().commit();
|
||||
|
||||
System.out.println(super.toString(sql));
|
||||
|
||||
|
||||
int genId = entityE.getId();
|
||||
em.clear();
|
||||
em.getTransaction().begin();
|
||||
|
|
|
@ -30,8 +30,6 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
|||
import org.apache.openjpa.persistence.test.AllowFailure;
|
||||
import org.apache.openjpa.persistence.test.SQLListenerTestCase;
|
||||
|
||||
@AllowFailure(message="Temporarily allowing this test to fail until cleanup " +
|
||||
"order issues are resolved.")
|
||||
public class TestNoSchemaManualDelimitedJoinAnnotations extends SQLListenerTestCase {
|
||||
OpenJPAEntityManager em;
|
||||
int id = 0;
|
||||
|
@ -46,14 +44,10 @@ public class TestNoSchemaManualDelimitedJoinAnnotations extends SQLListenerTestC
|
|||
@Override
|
||||
public void setUp() throws Exception {
|
||||
|
||||
// TODO: Delimiter support is currently limited to database that use
|
||||
// double quote as a delimiter.
|
||||
// Also Disabling DB2 until a SQLCODE -204 issue during the cleanup phase
|
||||
// is resolved.
|
||||
setUnsupportedDatabases(MySQLDictionary.class, DB2Dictionary.class);
|
||||
setUnsupportedDatabases(MySQLDictionary.class);
|
||||
if (isTestsDisabled())
|
||||
return;
|
||||
|
||||
|
||||
super.setUp(
|
||||
org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityC.class,
|
||||
org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD.class,
|
||||
|
|
|
@ -29,9 +29,9 @@ public class EntityH {
|
|||
|
||||
private String secName;
|
||||
|
||||
private Collection<EntityI> entityIs = new HashSet<EntityI>();
|
||||
private Collection<EntityI> eIs = new HashSet<EntityI>();
|
||||
|
||||
private EntityI2 entityI2;
|
||||
private EntityI2 eI2;
|
||||
|
||||
Map<EntityI3,EntityI4> map = new HashMap<EntityI3,EntityI4>();
|
||||
|
||||
|
@ -86,31 +86,31 @@ public class EntityH {
|
|||
}
|
||||
|
||||
public Collection<EntityI> getEntityIs() {
|
||||
return entityIs;
|
||||
return eIs;
|
||||
}
|
||||
/**
|
||||
* @param entityIs the entityIs to set
|
||||
*/
|
||||
public void setEntityIs(Collection<EntityI> entityIs) {
|
||||
this.entityIs = entityIs;
|
||||
this.eIs = entityIs;
|
||||
}
|
||||
|
||||
public void addEntityI(EntityI entityI) {
|
||||
entityIs.add(entityI);
|
||||
eIs.add(entityI);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entityI2
|
||||
*/
|
||||
public EntityI2 getEntityI2() {
|
||||
return entityI2;
|
||||
return eI2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entityI2 the entityI2 to set
|
||||
*/
|
||||
public void setEntityI2(EntityI2 entityI2) {
|
||||
this.entityI2 = entityI2;
|
||||
this.eI2 = entityI2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.HashSet;
|
|||
public class EntityI {
|
||||
private int id;
|
||||
private String name;
|
||||
private Collection<EntityH> entityHs = new HashSet<EntityH>();
|
||||
private Collection<EntityH> eHs = new HashSet<EntityH>();
|
||||
|
||||
public EntityI() {}
|
||||
|
||||
|
@ -64,17 +64,17 @@ public class EntityI {
|
|||
* @return the entityHs
|
||||
*/
|
||||
public Collection<EntityH> getEntityHs() {
|
||||
return entityHs;
|
||||
return eHs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entityHs the entityHs to set
|
||||
*/
|
||||
public void setEntityHs(Collection<EntityH> entityHs) {
|
||||
this.entityHs = entityHs;
|
||||
this.eHs = entityHs;
|
||||
}
|
||||
|
||||
public void addEntityH(EntityH entityH) {
|
||||
entityHs.add(entityH);
|
||||
eHs.add(entityH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class EntityI2 {
|
|||
private int id;
|
||||
private String name;
|
||||
|
||||
private EntityI3 entityI3;
|
||||
private EntityI3 eI3;
|
||||
|
||||
public EntityI2() {}
|
||||
|
||||
|
@ -62,13 +62,13 @@ public class EntityI2 {
|
|||
* @return the entityI3
|
||||
*/
|
||||
public EntityI3 getEntityI3() {
|
||||
return entityI3;
|
||||
return eI3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entityI3 the entityI3 to set
|
||||
*/
|
||||
public void setEntityI3(EntityI3 entityI3) {
|
||||
this.entityI3 = entityI3;
|
||||
this.eI3 = entityI3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ public class TestXmlDelimitedJoinAnnotation extends SQLListenerTestCase {
|
|||
private void queryJoinTable() {
|
||||
String query =
|
||||
"SELECT h " +
|
||||
"FROM EntityH h JOIN h.entityIs i " +
|
||||
"FROM EntityH h JOIN h.eIs i " +
|
||||
"WHERE i.name = 'ei'";
|
||||
Query q = em.createQuery(query);
|
||||
List<EntityH> results = (List<EntityH>)q.getResultList();
|
||||
|
@ -130,7 +130,7 @@ public class TestXmlDelimitedJoinAnnotation extends SQLListenerTestCase {
|
|||
private void queryJoinColumn() {
|
||||
String query =
|
||||
"SELECT h " +
|
||||
"FROM EntityH h JOIN h.entityI2 i2 " +
|
||||
"FROM EntityH h JOIN h.eI2 i2 " +
|
||||
"WHERE i2.name = 'ei2'";
|
||||
Query q = em.createQuery(query);
|
||||
List<EntityH> results = (List<EntityH>)q.getResultList();
|
||||
|
|
|
@ -18,82 +18,82 @@
|
|||
under the License.
|
||||
-->
|
||||
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
|
||||
http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
|
||||
version="2.0">
|
||||
version="2.0">
|
||||
<entity class="org.apache.openjpa.persistence.delimited.identifiers.xml.EntityH">
|
||||
<table name=""entity h"" schema=""delim xml""/>
|
||||
<table name=""xe h"" schema=""delim xml""/>
|
||||
<secondary-table name=""h sec join table"" schema=""delim xml"">
|
||||
<primary-key-join-column name=""entity h"" referenced-column-name=""h id""/>
|
||||
<primary-key-join-column name=""xe h"" referenced-column-name=""xh id""/>
|
||||
</secondary-table>
|
||||
<attributes>
|
||||
<id name="id">
|
||||
<column name=""h id""/>
|
||||
<column name=""xh id""/>
|
||||
</id>
|
||||
<basic name="name"/>
|
||||
<basic name="secName">
|
||||
<column name=""h sec join table""/>
|
||||
</basic>
|
||||
|
||||
<one-to-one name="entityI2">
|
||||
<join-column name=""enti2 id"" referenced-column-name=""entityI2 id""
|
||||
table=""join column""/>
|
||||
<one-to-one name="eI2">
|
||||
<join-column name=""e2 id"" referenced-column-name=""eI2 id""
|
||||
table=""j tb""/>
|
||||
</one-to-one>
|
||||
|
||||
<many-to-many name="entityIs">
|
||||
<many-to-many name="eIs">
|
||||
<join-table name=""h i"" schema=""delim xml""/>
|
||||
</many-to-many>
|
||||
|
||||
<many-to-many name="map">
|
||||
<map-key-join-column name=""map_ei3"" referenced-column-name=""entityI3 id""/>
|
||||
<join-table name=""map3 join table"" schema=""delim xml""/>
|
||||
<map-key-join-column name=""map_ei3"" referenced-column-name=""eI3 id""/>
|
||||
<join-table name=""m3 j t"" schema=""delim xml""/>
|
||||
</many-to-many>
|
||||
|
||||
<many-to-many name="map2">
|
||||
<map-key-join-column name=""map ei4"" referenced-column-name=""entityI4 id""
|
||||
table=""map key join column""/>
|
||||
<join-table name=""map4 join table"" schema=""delim xml""/>
|
||||
<map-key-join-column name=""map ei4"" referenced-column-name=""eI4 id""
|
||||
table=""m k j col""/>
|
||||
<join-table name=""m4 j t"" schema=""delim xml""/>
|
||||
</many-to-many>
|
||||
</attributes>
|
||||
</entity>
|
||||
|
||||
<entity class="org.apache.openjpa.persistence.delimited.identifiers.xml.EntityI">
|
||||
<table name=""entity i"" schema=""delim xml""/>
|
||||
<table name=""xe i"" schema=""delim xml""/>
|
||||
<attributes>
|
||||
<id name="id"/>
|
||||
<many-to-many name="entityHs" mapped-by="entityIs"/>
|
||||
<many-to-many name="eHs" mapped-by="eIs"/>
|
||||
</attributes>
|
||||
</entity>
|
||||
|
||||
<entity class="org.apache.openjpa.persistence.delimited.identifiers.xml.EntityI2">
|
||||
<table name=""entity i2"" schema=""delim xml""/>
|
||||
<table name=""xe i2"" schema=""delim xml""/>
|
||||
<attributes>
|
||||
<id name="id">
|
||||
<column name=""entityI2 id""/>
|
||||
<column name=""eI2 id""/>
|
||||
</id>
|
||||
<basic name="name"/>
|
||||
<one-to-one name="entityI3">
|
||||
<one-to-one name="eI3">
|
||||
<primary-key-join-column/>
|
||||
</one-to-one>
|
||||
</attributes>
|
||||
</entity>
|
||||
|
||||
<entity class="org.apache.openjpa.persistence.delimited.identifiers.xml.EntityI3">
|
||||
<table name=""entity i3"" schema=""delim xml""/>
|
||||
<table name=""xe i3"" schema=""delim xml""/>
|
||||
<attributes>
|
||||
<id name="id">
|
||||
<column name=""entityI3 id""/>
|
||||
<column name=""eI3 id""/>
|
||||
</id>
|
||||
<basic name="name"/>
|
||||
</attributes>
|
||||
</entity>
|
||||
|
||||
<entity class="org.apache.openjpa.persistence.delimited.identifiers.xml.EntityI4">
|
||||
<table name=""entity i4"" schema=""delim xml""/>
|
||||
<table name=""xe i4"" schema=""delim xml""/>
|
||||
<attributes>
|
||||
<id name="id">
|
||||
<column name=""entityI4 id""/>
|
||||
<column name=""eI4 id""/>
|
||||
</id>
|
||||
<basic name="name"/>
|
||||
</attributes>
|
||||
|
|
|
@ -28,7 +28,7 @@ version="2.0">
|
|||
<id name="id">
|
||||
<generated-value strategy="SEQUENCE" generator="xml-seq-gen"/>
|
||||
<sequence-generator name="xml-seq-gen" sequence-name=""xml seq gen""
|
||||
schema=""delim xml""/>
|
||||
schema=""delim xml seq""/>
|
||||
</id>
|
||||
<basic name="name">
|
||||
<column name=""b name""/>
|
||||
|
|
Loading…
Reference in New Issue