OPENJPA-1074 Fix for bidirectional ordered relationships. Modified order column tests to be included in compile time enhancement.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@780038 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeremy Bauer 2009-05-29 17:24:54 +00:00
parent dbc271305f
commit 49596dc4e6
20 changed files with 1084 additions and 320 deletions

View File

@ -207,9 +207,13 @@ public abstract class RelationToManyInverseKeyFieldStrategy
if (Proxies.isOwner(proxy, sm, field.getIndex()))
ct = proxy.getChangeTracker();
}
Column order = field.getOrderColumn();
// if no fine-grained change tracking then just delete and reinsert
if (ct == null || !ct.isTracking()) {
// if no fine-grained change tracking or if an item was removed
// from an ordered collection, delete and reinsert
if (ct == null || !ct.isTracking() ||
(order != null && !ct.getRemoved().isEmpty())) {
delete(sm, store, rm);
insert(sm, rm, obj);
return;
@ -229,7 +233,7 @@ public abstract class RelationToManyInverseKeyFieldStrategy
int seq = ct.getNextSequence();
for (Iterator itr = add.iterator(); itr.hasNext(); seq++)
updateInverse(ctx, itr.next(), rel, rm, sm, seq);
if (field.getOrderColumn() != null)
if (order != null)
ct.setNextSequence(seq);
}

View File

@ -0,0 +1,59 @@
/*
* 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.jdbc.order;
public class BaseTestElement1 {
private int id;
private String name;
public BaseTestElement1() {
}
public BaseTestElement1(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public boolean equals(Object obj) {
if (obj instanceof BaseTestElement1) {
BaseTestElement1 bte = (BaseTestElement1)obj;
return getId() == bte.getId() &&
bte.getName().equalsIgnoreCase(bte.getName());
}
return false;
}
}

View File

@ -0,0 +1,59 @@
/*
* 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.jdbc.order;
public class BaseTestElement2 {
private int id;
private String name;
public BaseTestElement2() {
}
public BaseTestElement2(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public boolean equals(Object obj) {
if (obj instanceof BaseTestElement2) {
BaseTestElement2 bte = (BaseTestElement2)obj;
return getId() == bte.getId() &&
bte.getName().equalsIgnoreCase(bte.getName());
}
return false;
}
}

View File

@ -0,0 +1,59 @@
/*
* 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.jdbc.order;
public class BaseTestElement3 {
private int id;
private String name;
public BaseTestElement3() {
}
public BaseTestElement3(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public boolean equals(Object obj) {
if (obj instanceof BaseTestElement3) {
BaseTestElement3 bte = (BaseTestElement3)obj;
return getId() == bte.getId() &&
bte.getName().equalsIgnoreCase(bte.getName());
}
return false;
}
}

View File

@ -0,0 +1,68 @@
/*
* 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.jdbc.order;
import java.util.List;
import java.util.Set;
/*
* Entity used for testing custom column definitions base values.
*/
public class BaseTestEntity1 {
private int id;
private List<BaseTestElement1> one2Melems;
private List<BaseTestElement1> m2melems;
private Set<BaseTestElement1> collelems;
public void setOne2Melems(List<BaseTestElement1> one2Melems) {
this.one2Melems = one2Melems;
}
public List<BaseTestElement1> getOne2Melems() {
return one2Melems;
}
public void setCollelems(Set<BaseTestElement1> collelems) {
this.collelems = collelems;
}
public Set<BaseTestElement1> getCollelems() {
return collelems;
}
public void setM2melems(List<BaseTestElement1> m2melems) {
this.m2melems = m2melems;
}
public List<BaseTestElement1> getM2melems() {
return m2melems;
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
}

View File

@ -0,0 +1,68 @@
/*
* 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.jdbc.order;
import java.util.List;
import java.util.Set;
/*
* Entity used for testing custom column defintions base values.
*/
public class BaseTestEntity2 {
private int id;
private List<BaseTestElement2> one2Melems;
private List<BaseTestElement2> m2melems;
private Set<BaseTestElement2> collelems;
public void setOne2Melems(List<BaseTestElement2> one2Melems) {
this.one2Melems = one2Melems;
}
public List<BaseTestElement2> getOne2Melems() {
return one2Melems;
}
public void setCollelems(Set<BaseTestElement2> collelems) {
this.collelems = collelems;
}
public Set<BaseTestElement2> getCollelems() {
return collelems;
}
public void setM2melems(List<BaseTestElement2> m2melems) {
this.m2melems = m2melems;
}
public List<BaseTestElement2> getM2melems() {
return m2melems;
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
}

View File

@ -0,0 +1,68 @@
/*
* 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.jdbc.order;
import java.util.List;
import java.util.Set;
/*
* Entity used for testing custom column defintions base values.
*/
public class BaseTestEntity3 {
private int id;
private List<BaseTestElement3> one2Melems;
private List<BaseTestElement3> m2melems;
private Set<BaseTestElement3> collelems;
public void setOne2Melems(List<BaseTestElement3> one2Melems) {
this.one2Melems = one2Melems;
}
public List<BaseTestElement3> getOne2Melems() {
return one2Melems;
}
public void setCollelems(Set<BaseTestElement3> collelems) {
this.collelems = collelems;
}
public Set<BaseTestElement3> getCollelems() {
return collelems;
}
public void setM2melems(List<BaseTestElement3> m2melems) {
this.m2melems = m2melems;
}
public List<BaseTestElement3> getM2melems() {
return m2melems;
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
}

View File

@ -0,0 +1,81 @@
/*
* 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.jdbc.order;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
@Entity
public class BiOrderEntity implements java.io.Serializable {
private static final long serialVersionUID = -1059986449941927485L;
@Id
private int id;
private String name;
@ManyToOne
private BiOrderMappedByEntity bo2mbEntity;
public BiOrderEntity() {
}
public BiOrderEntity(String name) {
this.id = name.charAt(0) - 'A' + 1;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BiOrderMappedByEntity getEntity() {
return bo2mbEntity;
}
public void setEntity(BiOrderMappedByEntity ent) {
this.bo2mbEntity = ent;
}
public boolean equals(Object obj) {
if (obj instanceof BiOrderEntity) {
BiOrderEntity boe = (BiOrderEntity)obj;
return boe.getId() == getId() &&
boe.getName().equals(getName());
}
return false;
}
}

View File

@ -0,0 +1,87 @@
/*
* 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.jdbc.order;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderColumn;
@Entity
public class BiOrderMappedByEntity {
@Id
private int id;
@OneToMany(mappedBy="bo2mbEntity")
@OrderColumn(name="bo2mEntities_ORDER")
private List<BiOrderEntity> bo2mEntities;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public List<BiOrderEntity> getBo2mEntities() {
return bo2mEntities;
}
public void setBo2mEntity(List<BiOrderEntity> names) {
this.bo2mEntities = names;
}
public void addBo2mEntity(BiOrderEntity name) {
if( bo2mEntities == null) {
bo2mEntities = new ArrayList<BiOrderEntity>();
}
bo2mEntities.add(name);
}
public BiOrderEntity removeBo2mEntity(int location) {
BiOrderEntity rtnVal = null;
if( bo2mEntities != null) {
rtnVal = bo2mEntities.remove(location);
}
return rtnVal;
}
public void insertBo2mEntity(int location, BiOrderEntity name) {
if( bo2mEntities == null) {
bo2mEntities = new ArrayList<BiOrderEntity>();
}
bo2mEntities.add(location, name);
}
public boolean equals(Object obj) {
if (obj instanceof BiOrderMappedByEntity) {
BiOrderMappedByEntity boe = (BiOrderMappedByEntity)obj;
return boe.getId() == getId();
}
return false;
}
}

View File

@ -18,42 +18,25 @@
*/
package org.apache.openjpa.persistence.jdbc.order;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.TreeMap;
import javax.persistence.Query;
import org.apache.openjpa.conf.OpenJPAConfiguration;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.meta.ClassMapping;
import org.apache.openjpa.jdbc.meta.FieldMapping;
import org.apache.openjpa.jdbc.schema.Column;
import org.apache.openjpa.jdbc.schema.Sequence;
import org.apache.openjpa.jdbc.schema.Table;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.lib.meta.MetaDataSerializer;
import org.apache.openjpa.meta.ClassMetaData;
import org.apache.openjpa.meta.MetaDataRepository;
import org.apache.openjpa.persistence.ArgumentException;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
import org.apache.openjpa.persistence.OpenJPAPersistence;
import org.apache.openjpa.persistence.jdbc.XMLPersistenceMappingParser;
import org.apache.openjpa.persistence.jdbc.XMLPersistenceMappingSerializer;
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
public class TestOrderColumn extends SingleEMFTestCase {
@ -66,7 +49,7 @@ public class TestOrderColumn extends SingleEMFTestCase {
Trainer.class, Game.class, Inning.class,
Course.class, Student.class,
Owner.class, Bicycle.class, Car.class, Home.class,
Widget.class);
Widget.class,BiOrderMappedByEntity.class, BiOrderEntity.class );
try {
createQueryData();
} catch (Exception e) {
@ -138,6 +121,74 @@ public class TestOrderColumn extends SingleEMFTestCase {
em.close();
}
/*
* Verifies that a collection remains contiguous and element
* indexes are reordered if an element is removed for a
* OneToMany relationship
*/
public void testOneToManyBiDirElementRemoval() {
OpenJPAEntityManagerSPI em = emf.createEntityManager();
// Verify field name is the default via fm
validateOrderColumnName(BiOrderMappedByEntity.class, "bo2mEntities",
"bo2mEntities_ORDER");
// Create some data
BiOrderMappedByEntity bome = new BiOrderMappedByEntity();
bome.setId(1);
List<BiOrderEntity> boea = new ArrayList<BiOrderEntity>();
for (int i = 0; i < 5; i++) {
BiOrderEntity boe = new BiOrderEntity();
boe.setId(i+1);
boe.setName("Entity" + i);
boe.setEntity(bome);
boea.add(boe);
bome.addBo2mEntity(boe);
}
// Persist
em.getTransaction().begin();
em.persist(bome);
for (BiOrderEntity boe : boea) {
em.persist(boe);
}
em.getTransaction().commit();
em.refresh(bome);
em.clear();
// Verify order is correct.
BiOrderMappedByEntity newBome = em.find(BiOrderMappedByEntity.class,
bome.getId());
assertNotNull(newBome);
for (int i = 0; i < 5 ; i++) {
assertEquals(newBome.getBo2mEntities().get(i), boea.get(i));
}
// Remove an item
em.getTransaction().begin();
newBome.getBo2mEntities().get(2).setEntity(null);
newBome.removeBo2mEntity(2);
boea.remove(2);
em.getTransaction().commit();
em.clear();
// Simple assertion via find
newBome = em.find(BiOrderMappedByEntity.class, bome.getId());
assertNotNull(newBome);
assertNotNull(newBome.getBo2mEntities());
assertEquals(boea.size(), newBome.getBo2mEntities().size());
for (int i = 0; i < boea.size() ; i++) {
assertEquals(newBome.getBo2mEntities().get(i), (boea.get(i)));
}
// Stronger assertion via INDEX value
validateIndexAndValues(em, "BiOrderMappedByEntity", "bo2mEntities", 0,
boea.toArray(), "id",
bome.getId());
em.close();
}
/*
* Verifies that a collection remains contiguous and element
* indexes are reordered if an element is removed for an
@ -181,23 +232,28 @@ public class TestOrderColumn extends SingleEMFTestCase {
// Remove some dates
em.getTransaction().begin();
game.getRainDates().remove(4);
newGame.getRainDates().remove(4);
rainDates.remove(4);
game.getRainDates().remove(2);
newGame.getRainDates().remove(2);
rainDates.remove(2);
em.getTransaction().commit();
em.clear();
newGame = em.find(Game.class, game.getId());
assertNotNull(newGame);
assertNotNull(game.getRainDates());
assertEquals(8, game.getRainDates().size());
assertNotNull(newGame.getRainDates());
assertEquals(8, newGame.getRainDates().size());
// Verify the order
for (int i = 0; i < game.getRainDates().size(); i++) {
assertEquals(game.getRainDates().get(i),
rainDates.get(i));
for (int i = 0; i < newGame.getRainDates().size(); i++) {
assertEquals(newGame.getRainDates().get(i).toString(),
rainDates.get(i).toString());
}
// Stronger assertion via INDEX value
validateCollIndexAndValues(em, "Game", "rainDates", 0,
newGame.getRainDates().toArray(), "id",
newGame.getId());
em.close();
}
/*
@ -643,34 +699,6 @@ public class TestOrderColumn extends SingleEMFTestCase {
em.close();
}
/*
* Validates the use of the nullable attribute on OrderColumn through
* an entity defined in orm.xml
*/
public void testOrderColumnNullableFalse() {
OpenJPAEntityManagerFactorySPI emf1 =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("BaseNoNullTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence-4.xml");
validateOrderColumnNullable(emf1, BaseTestEntity.class,
"one2Melems", false);
validateOrderColumnNullable(emf1, BaseTestEntity.class,
"collelems", false);
validateOrderColumnNullable(emf1, BaseTestEntity.class,
"m2melems", false);
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
/*
* Validates the use of the updatable on OrderColumn. insertable=false
@ -711,76 +739,6 @@ public class TestOrderColumn extends SingleEMFTestCase {
em.close();
}
/*
* Validates the use of the columnDefinition attribute on OrderColumn. This
* test will be skipped unless the database in use is Derby since the
* annotation column definition attribute value is hard coded and all
* databases may not support the supplied column definition.
*/
public void testOrderColumnColumnDefinition() {
if (!isTargetPlatform("derby")) {
return;
}
OpenJPAEntityManagerFactorySPI emf1 =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("ColDefTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence-2.xml");
// Create the EM. This will spark the mapping tool.
OpenJPAEntityManagerSPI em = emf1.createEntityManager();
//
// Create a collection using a custom column definition
validateOrderColumnDef(emf1, ColDefTestEntity.class,
"one2Mcoldef", "BIGINT");
validateOrderColumnDef(emf1, ColDefTestEntity.class,
"collcoldef", "BIGINT");
validateOrderColumnDef(emf1, ColDefTestEntity.class,
"m2mcoldef", "BIGINT");
// Add and query some values
ColDefTestEntity cdent = new ColDefTestEntity();
ColDefTestElement cdel1 = new ColDefTestElement("Element1");
ColDefTestElement cdel2 = new ColDefTestElement("Element2");
ColDefTestElement cdel3 = new ColDefTestElement("Element3");
List<ColDefTestElement> one2Mcoldef =
new ArrayList<ColDefTestElement>();
one2Mcoldef.add(cdel3);
one2Mcoldef.add(cdel2);
one2Mcoldef.add(cdel1);
cdent.setOne2Mcoldef(one2Mcoldef);
Set<ColDefTestElement> collcoldef =
new LinkedHashSet<ColDefTestElement>();
collcoldef.add(cdel1);
collcoldef.add(cdel2);
collcoldef.add(cdel3);
cdent.setCollcoldef(collcoldef);
List<ColDefTestElement> m2mcoldef = new ArrayList<ColDefTestElement>();
m2mcoldef.add(cdel2);
m2mcoldef.add(cdel1);
m2mcoldef.add(cdel3);
cdent.setM2mcoldef(m2mcoldef);
em.getTransaction().begin();
em.persist(cdent);
em.getTransaction().commit();
em.close();
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
/*
* Validates the use of the table attribute on OrderColumn with
* o2o, o2m, m2m, and collection table - with and without join
@ -861,37 +819,6 @@ public class TestOrderColumn extends SingleEMFTestCase {
em.close();
}
/**
* Validates the use of the table attribute defined in XML
*/
public void testOrderColumnTableXML() {
OpenJPAEntityManagerFactorySPI emf1 =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("TableTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence-5.xml");
OpenJPAEntityManagerSPI em = emf1.createEntityManager();
validateOrderColumnTable(emf1, BaseTestEntity.class, "one2Melems",
"xml_o2m_table", "one2MOrder");
validateOrderColumnTable(emf1, BaseTestEntity.class, "m2melems",
"xml_m2m_table", "m2morder");
validateOrderColumnTable(emf1, BaseTestEntity.class, "collelems",
"xml_coll_table", "collelems_ORDER");
em.close();
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
/*
* Validates the use of order column (via INDEX) in the predicate of a
* JPQL query.
@ -959,104 +886,6 @@ public class TestOrderColumn extends SingleEMFTestCase {
em.close();
}
/*
* Validates OrderBy and OrderColumn should not be specified together per
* the JPA 2.0 spec.
*/
public void testOrderColumnOrderBy() {
OpenJPAEntityManagerFactorySPI emf1 = null;
OpenJPAEntityManagerSPI em = null;
try {
emf1 = (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("ObOcTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence-3.xml");
em = emf1.createEntityManager();
ObOcEntity ent = new ObOcEntity();
List<Integer> intList = new ArrayList<Integer>();
intList.add(new Integer(10));
intList.add(new Integer(20));
ent.setIntList(intList);
em.getTransaction().begin();
em.persist(intList);
em.getTransaction().commit();
em.close();
em = null;
fail("An exception should have been thrown.");
} catch (Exception e) {
assertException(e, ArgumentException.class);
} finally {
if (em != null)
em.close();
}
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
public void testOrderColumnMetaDataSerialization()
throws Exception {
OpenJPAEntityManagerFactorySPI emf1 =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("BaseTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence.xml");
OpenJPAConfiguration conf = emf1.getConfiguration();
MetaDataRepository repos = conf.newMetaDataRepositoryInstance();
// Force entity resolution
repos.getMetaData(BaseTestEntity.class, null, true);
XMLPersistenceMappingSerializer ser =
new XMLPersistenceMappingSerializer((JDBCConfiguration)conf);
ser.addAll(repos);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ser.serialize(new OutputStreamWriter(out), MetaDataSerializer.PRETTY);
byte[] bytes = out.toByteArray();
XMLPersistenceMappingParser parser =
new XMLPersistenceMappingParser((JDBCConfiguration)conf);
parser.parse(new InputStreamReader
(new ByteArrayInputStream(bytes)), "bytes");
MetaDataRepository mdr2 = parser.getRepository();
ClassMetaData _entityMeta2 =
mdr2.getMetaData(BaseTestEntity.class, null, true);
// Assert metadata is populated correctly
FieldMapping fm = (FieldMapping)_entityMeta2.getField("one2Melems");
Column oc = fm.getOrderColumn();
assertNotNull(oc);
assertEquals(oc.getName(),"one2MOrder");
fm = (FieldMapping)_entityMeta2.getField("m2melems");
oc = fm.getOrderColumn();
assertNotNull(oc);
assertEquals(oc.getName(),"m2morder");
fm = (FieldMapping)_entityMeta2.getField("collelems");
oc = fm.getOrderColumn();
assertNotNull(oc);
assertEquals(oc.getName(),"collelems_ORDER");
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
/*
* Create the data used by the query tests
*/
@ -1127,6 +956,33 @@ public class TestOrderColumn extends SingleEMFTestCase {
}
}
private void validateCollIndexAndValues(OpenJPAEntityManagerSPI em,
String entity, String indexedCol, int base, Object[] objs, String
idField, Object idValue) {
String queryString =
"SELECT INDEX(b), b FROM " + entity + " a, IN(a." + indexedCol
+ ") b WHERE a." + idField + " = :idVal";
em.clear();
Query qry = em.createQuery(queryString);
qry.setParameter("idVal", idValue);
List rlist = qry.getResultList();
assertNotNull(rlist);
assertEquals(objs.length, rlist.size());
TreeMap<Long, Object> objMap = new TreeMap<Long, Object>();
for (int i = 0; i < objs.length; i++)
{
Object[] rvals = (Object[])rlist.get(i);
Long idx = (Long)rvals[0];
Object objVal = rvals[1];
objMap.put(idx, objVal);
}
for (int i = 0; i < objs.length; i++) {
Object val = objMap.get((new Long(base + i)));
assertEquals(val, objs[i]);
}
}
private void validateOrderColumnName(Class clazz, String fieldName,
String columnName) {
validateOrderColumnName(emf, clazz, fieldName, columnName);
@ -1161,20 +1017,6 @@ public class TestOrderColumn extends SingleEMFTestCase {
columnName));
}
private void validateOrderColumnDef(
OpenJPAEntityManagerFactorySPI emf1, Class clazz, String fieldName,
String type) {
Column oc = getOrderColumn(emf1, clazz, fieldName);
assertEquals(type, oc.getTypeName());
}
private void validateOrderColumnNullable(
OpenJPAEntityManagerFactorySPI emf1, Class clazz, String fieldName,
boolean nullable) {
Column oc = getOrderColumn(emf1, clazz, fieldName);
assertEquals(nullable, !oc.isNotNull());
}
private void validateOrderColumnUpdatable(
OpenJPAEntityManagerFactorySPI emf1, Class clazz, String fieldName,
boolean updatable) {
@ -1227,25 +1069,4 @@ public class TestOrderColumn extends SingleEMFTestCase {
}
return false;
}
/**
* Closes a specific entity manager factory and cleans up
* associated tables.
*/
private void cleanupEMF(OpenJPAEntityManagerFactorySPI emf1)
throws Exception {
if (emf1 == null)
return;
try {
clear(emf1);
} catch (Exception e) {
// if a test failed, swallow any exceptions that happen
// during tear-down, as these just mask the original problem.
if (testResult.wasSuccessful())
throw e;
} finally {
closeEMF(emf1);
}
}
}

View File

@ -0,0 +1,387 @@
/*
* 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.jdbc.order;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.apache.openjpa.conf.OpenJPAConfiguration;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.meta.ClassMapping;
import org.apache.openjpa.jdbc.meta.FieldMapping;
import org.apache.openjpa.jdbc.schema.Column;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.lib.meta.MetaDataSerializer;
import org.apache.openjpa.meta.ClassMetaData;
import org.apache.openjpa.meta.MetaDataRepository;
import org.apache.openjpa.persistence.ArgumentException;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
import org.apache.openjpa.persistence.OpenJPAPersistence;
import org.apache.openjpa.persistence.jdbc.XMLPersistenceMappingParser;
import org.apache.openjpa.persistence.jdbc.XMLPersistenceMappingSerializer;
import org.apache.openjpa.persistence.test.PersistenceTestCase;
public class TestOrderColumnXML extends PersistenceTestCase {
/*
* Validates the use of the nullable attribute on OrderColumn through
* an entity defined in orm.xml
*/
public void testOrderColumnNullableFalse() {
OpenJPAEntityManagerFactorySPI emf1 =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("BaseNoNullTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence-4.xml");
OpenJPAConfiguration conf = emf1.getConfiguration();
MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
// Force entity resolution
repos.getMetaData(BaseTestEntity2.class, null, true);
OpenJPAEntityManagerSPI em = emf1.createEntityManager();
validateOrderColumnNullable(emf1, BaseTestEntity2.class,
"one2Melems", false);
validateOrderColumnNullable(emf1, BaseTestEntity2.class,
"collelems", false);
validateOrderColumnNullable(emf1, BaseTestEntity2.class,
"m2melems", false);
em.close();
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
/*
* Validates the use of the columnDefinition attribute on OrderColumn. This
* test will be skipped unless the database in use is Derby since the
* annotation column definition attribute value is hard coded and all
* databases may not support the supplied column definition.
*/
public void testOrderColumnColumnDefinition() {
if (!isTargetPlatform("derby")) {
return;
}
OpenJPAEntityManagerFactorySPI emf1 =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("ColDefTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence-2.xml");
// Create the EM. This will spark the mapping tool.
OpenJPAEntityManagerSPI em = emf1.createEntityManager();
//
// Create a collection using a custom column definition
validateOrderColumnDef(emf1, ColDefTestEntity.class,
"one2Mcoldef", "BIGINT");
validateOrderColumnDef(emf1, ColDefTestEntity.class,
"collcoldef", "BIGINT");
validateOrderColumnDef(emf1, ColDefTestEntity.class,
"m2mcoldef", "BIGINT");
// Add and query some values
ColDefTestEntity cdent = new ColDefTestEntity();
ColDefTestElement cdel1 = new ColDefTestElement("Element1");
ColDefTestElement cdel2 = new ColDefTestElement("Element2");
ColDefTestElement cdel3 = new ColDefTestElement("Element3");
List<ColDefTestElement> one2Mcoldef =
new ArrayList<ColDefTestElement>();
one2Mcoldef.add(cdel3);
one2Mcoldef.add(cdel2);
one2Mcoldef.add(cdel1);
cdent.setOne2Mcoldef(one2Mcoldef);
Set<ColDefTestElement> collcoldef =
new LinkedHashSet<ColDefTestElement>();
collcoldef.add(cdel1);
collcoldef.add(cdel2);
collcoldef.add(cdel3);
cdent.setCollcoldef(collcoldef);
List<ColDefTestElement> m2mcoldef = new ArrayList<ColDefTestElement>();
m2mcoldef.add(cdel2);
m2mcoldef.add(cdel1);
m2mcoldef.add(cdel3);
cdent.setM2mcoldef(m2mcoldef);
em.getTransaction().begin();
em.persist(cdent);
em.getTransaction().commit();
em.close();
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
/**
* Validates the use of the table attribute defined in XML
*/
public void testOrderColumnTableXML() {
OpenJPAEntityManagerFactorySPI emf1 =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("TableTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence-5.xml");
OpenJPAEntityManagerSPI em = emf1.createEntityManager();
validateOrderColumnTable(emf1, BaseTestEntity3.class, "one2Melems",
"xml_o2m_table", "one2MOrder");
validateOrderColumnTable(emf1, BaseTestEntity3.class, "m2melems",
"xml_m2m_table", "m2morder");
validateOrderColumnTable(emf1, BaseTestEntity3.class, "collelems",
"xml_coll_table", "collelems_ORDER");
em.close();
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
/*
* Validates OrderBy and OrderColumn should not be specified together per
* the JPA 2.0 spec.
*/
public void testOrderColumnOrderBy() {
OpenJPAEntityManagerFactorySPI emf1 = null;
OpenJPAEntityManagerSPI em = null;
try {
emf1 = (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("ObOcTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence-3.xml");
em = emf1.createEntityManager();
ObOcEntity ent = new ObOcEntity();
List<Integer> intList = new ArrayList<Integer>();
intList.add(new Integer(10));
intList.add(new Integer(20));
ent.setIntList(intList);
em.getTransaction().begin();
em.persist(intList);
em.getTransaction().commit();
em.close();
em = null;
fail("An exception should have been thrown.");
} catch (Exception e) {
assertException(e, ArgumentException.class);
} finally {
if (em != null)
em.close();
}
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
public void testOrderColumnMetaDataSerialization()
throws Exception {
OpenJPAEntityManagerFactorySPI emf1 =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("BaseTest",
"org/apache/openjpa/persistence/jdbc/order/" +
"order-persistence.xml");
OpenJPAConfiguration conf = emf1.getConfiguration();
MetaDataRepository repos = conf.newMetaDataRepositoryInstance();
// Force entity resolution
repos.getMetaData(BaseTestEntity1.class, null, true);
XMLPersistenceMappingSerializer ser =
new XMLPersistenceMappingSerializer((JDBCConfiguration)conf);
ser.addAll(repos);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ser.serialize(new OutputStreamWriter(out), MetaDataSerializer.PRETTY);
byte[] bytes = out.toByteArray();
XMLPersistenceMappingParser parser =
new XMLPersistenceMappingParser((JDBCConfiguration)conf);
parser.parse(new InputStreamReader
(new ByteArrayInputStream(bytes)), "bytes");
MetaDataRepository mdr2 = parser.getRepository();
ClassMetaData _entityMeta2 =
mdr2.getMetaData(BaseTestEntity1.class, null, true);
// Assert metadata is populated correctly
FieldMapping fm = (FieldMapping)_entityMeta2.getField("one2Melems");
Column oc = fm.getOrderColumn();
assertNotNull(oc);
assertEquals(oc.getName(),"one2MOrder");
fm = (FieldMapping)_entityMeta2.getField("m2melems");
oc = fm.getOrderColumn();
assertNotNull(oc);
assertEquals(oc.getName(),"m2morder");
fm = (FieldMapping)_entityMeta2.getField("collelems");
oc = fm.getOrderColumn();
assertNotNull(oc);
assertEquals(oc.getName(),"collelems_ORDER");
try {
if (emf1 != null)
cleanupEMF(emf1);
} catch (Exception e) {
fail(e.getMessage());
}
}
private Column getOrderColumn(OpenJPAEntityManagerFactorySPI emf1,
Class clazz, String fieldName) {
JDBCConfiguration conf = (JDBCConfiguration) emf1.getConfiguration();
ClassMapping cls = conf.getMappingRepositoryInstance().
getMapping(clazz, null, true);
FieldMapping fm = cls.getFieldMapping(fieldName);
Column oc = fm.getOrderColumn();
assertNotNull(oc);
return oc;
}
private void validateOrderColumnTable(
OpenJPAEntityManagerFactorySPI emf1,
Class clazz, String fieldName, String tableName,
String columnName) {
Column oc = getOrderColumn(emf1, clazz, fieldName);
// Verify the oc has the correct table name
assertTrue(oc.getTableName().equalsIgnoreCase(tableName));
// Verify the table exists in the db
assertTrue(tableAndColumnExists(emf1, null, tableName, null,
columnName));
}
private void validateOrderColumnDef(
OpenJPAEntityManagerFactorySPI emf1, Class clazz, String fieldName,
String type) {
Column oc = getOrderColumn(emf1, clazz, fieldName);
assertEquals(type, oc.getTypeName());
}
private void validateOrderColumnNullable(
OpenJPAEntityManagerFactorySPI emf1, Class clazz, String fieldName,
boolean nullable) {
Column oc = getOrderColumn(emf1, clazz, fieldName);
assertEquals(nullable, !oc.isNotNull());
}
/**
* Method to verify a table was created for the given name and schema
*/
private boolean tableAndColumnExists(OpenJPAEntityManagerFactorySPI emf1,
OpenJPAEntityManagerSPI em, String tableName, String schemaName,
String columnName) {
JDBCConfiguration conf = (JDBCConfiguration) emf1.getConfiguration();
DBDictionary dict = conf.getDBDictionaryInstance();
OpenJPAEntityManagerSPI em1 = em;
// If no em supplied, create one
if (em1 == null) {
em1 = emf1.createEntityManager();
}
Connection conn = (Connection)em1.getConnection();
try {
DatabaseMetaData dbmd = conn.getMetaData();
// (meta, catalog, schemaName, tableName, conn)
Column[] cols = dict.getColumns(dbmd, null, null,
tableName, columnName, conn);
if (cols != null && cols.length == 1) {
Column col = cols[0];
String colName = col.getName();
if (col.getTableName().equalsIgnoreCase(tableName) &&
(schemaName == null ||
col.getSchemaName().equalsIgnoreCase(schemaName)) &&
colName.equalsIgnoreCase(columnName))
return true;
}
} catch (Throwable e) {
fail("Unable to get column information.");
} finally {
if (em == null) {
em1.close();
}
}
return false;
}
/**
* Closes a specific entity manager factory and cleans up
* associated tables.
*/
private void cleanupEMF(OpenJPAEntityManagerFactorySPI emf1)
throws Exception {
if (emf1 == null)
return;
try {
clear(emf1);
} catch (Exception e) {
// if a test failed, swallow any exceptions that happen
// during tear-down, as these just mask the original problem.
if (testResult.wasSuccessful())
throw e;
} finally {
closeEMF(emf1);
}
}
}

View File

@ -526,6 +526,25 @@ public abstract class PersistenceTestCase
return false;
}
/**
* Determines whether specified platform is the target database platform
* in use by the test framework.
* @param target platform name (derby, db2, oracle, etc.)
* @return true if the specified platform matches the platform in use
*/
public boolean isTargetPlatform(String target) {
String url = getPlatform();
return url != null && url.indexOf(target) != -1;
}
/**
* Returns the platform in use by the test framework
* @return the database platform
*/
public String getPlatform() {
return System.getProperty("platform", "derby");
}
private static class FixedMap extends LinkedHashMap<EMFKey,
OpenJPAEntityManagerFactorySPI> {
public boolean removeEldestEntry(Map.Entry<EMFKey,

View File

@ -148,25 +148,6 @@ public abstract class SingleEMFTestCase
.getResultList();
}
/**
* Determines whether specified platform is the target database platform
* in use by the test framework.
* @param target platform name (derby, db2, oracle, etc.)
* @return true if the specified platform matches the platform in use
*/
public boolean isTargetPlatform(String target) {
String url = getPlatform();
return url != null && url.indexOf(target) != -1;
}
/**
* Returns the platform in use by the test framework
* @return the database platform
*/
public String getPlatform() {
return System.getProperty("platform", "derby");
}
public String getAlias(Class<?> t) {
return emf.getConfiguration().getMetaDataRepositoryInstance()
.getMetaData(t, null, true).getTypeAlias();

View File

@ -45,6 +45,9 @@
<mapping-file>org/apache/openjpa/persistence/access/access-def-prop-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/access/access-pudef-field-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/access/access-pudef-prop-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/jdbc/order/order-orm.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/jdbc/order/order-orm-2.xml</mapping-file>
<mapping-file>org/apache/openjpa/persistence/jdbc/order/order-orm-3.xml</mapping-file>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>

View File

@ -24,7 +24,7 @@
<package>
org.apache.openjpa.persistence.jdbc.order
</package>
<entity name="BaseTestNoNullElement" class="BaseTestElement"
<entity name="BaseTestNoNullElement" class="BaseTestElement2"
access="PROPERTY">
<table name="BTNNEL"/>
<attributes>
@ -34,7 +34,7 @@
<basic name="name"/>
</attributes>
</entity>
<entity name="BaseTestNoNullEntity" class="BaseTestEntity" access="FIELD">
<entity name="BaseTestNoNullEntity" class="BaseTestEntity2" access="FIELD">
<table name="BTNNEN"/>
<attributes>
<id name="id">

View File

@ -24,7 +24,7 @@
<package>
org.apache.openjpa.persistence.jdbc.order
</package>
<entity name="BaseTestTableElement" class="BaseTestElement"
<entity name="BaseTestTableElement" class="BaseTestElement3"
access="PROPERTY">
<table name="BTTEL"/>
<attributes>
@ -34,7 +34,7 @@
<basic name="name"/>
</attributes>
</entity>
<entity name="BaseTestTableEntity" class="BaseTestEntity" access="FIELD">
<entity name="BaseTestTableEntity" class="BaseTestEntity3" access="FIELD">
<table name="BTNNEN"/>
<attributes>
<id name="id">

View File

@ -24,7 +24,7 @@
<package>
org.apache.openjpa.persistence.jdbc.order
</package>
<entity name="BaseTestElement" class="BaseTestElement" access="PROPERTY">
<entity name="BaseTestElement" class="BaseTestElement1" access="PROPERTY">
<attributes>
<id name="id">
<generated-value/>
@ -32,7 +32,7 @@
<basic name="name"/>
</attributes>
</entity>
<entity name="BaseTestEntity" class="BaseTestEntity" access="FIELD">
<entity name="BaseTestEntity" class="BaseTestEntity1" access="FIELD">
<attributes>
<id name="id">
<generated-value/>

View File

@ -27,8 +27,8 @@
<description>PU for order column testing</description>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<mapping-file>org/apache/openjpa/persistence/jdbc/order/order-orm-2.xml</mapping-file>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestEntity</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestElement</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestEntity2</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestElement2</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
</properties>

View File

@ -27,8 +27,8 @@
<description>PU for order column testing</description>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<mapping-file>org/apache/openjpa/persistence/jdbc/order/order-orm-3.xml</mapping-file>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestEntity</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestElement</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestEntity3</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestElement3</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
</properties>

View File

@ -27,8 +27,8 @@
<description>PU for order column testing</description>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<mapping-file>org/apache/openjpa/persistence/jdbc/order/order-orm.xml</mapping-file>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestEntity</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestElement</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestEntity1</class>
<class>org.apache.openjpa.persistence.jdbc.order.BaseTestElement1</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
</properties>