openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openjpa] 02/02: OPENJPA-2764 fix tests with random behaviour
Date Wed, 02 Jan 2019 08:59:04 GMT
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git

commit 260042ba5184f1f415f2f0975e3449f13611b84a
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Wed Jan 2 09:58:03 2019 +0100

    OPENJPA-2764 fix tests with random behaviour
    
    The behaviour was random due to the undefined order in which
    real databases return data.
---
 .../TestDataCacheOptimisticLockRecovery.java         |  6 +-----
 .../jdbc/maps/m2mmapex0/TestMany2ManyMap.java        | 20 ++++++++++----------
 .../jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java     | 10 +++++-----
 .../jdbc/maps/m2mmapex10/TestMany2ManyMapEx10.java   |  2 +-
 .../jdbc/maps/m2mmapex2/TestMany2ManyMapEx2.java     |  2 +-
 .../jdbc/maps/m2mmapex3/TestMany2ManyMapEx3.java     |  2 +-
 .../jdbc/maps/m2mmapex4/TestMany2ManyMapEx4.java     | 12 ++++++------
 .../jdbc/maps/m2mmapex5/TestMany2ManyMapEx5.java     |  2 +-
 .../jdbc/maps/m2mmapex6/TestMany2ManyMapEx6.java     |  2 +-
 .../jdbc/maps/m2mmapex7/TestMany2ManyMapEx7.java     |  8 ++++----
 .../jdbc/maps/m2mmapex8/TestMany2ManyMapEx8.java     | 10 +++++-----
 .../jdbc/maps/m2mmapex9/TestMany2ManyMapEx9.java     |  8 ++++----
 .../maps/spec_10_1_26_ex1/TestSpec10_1_26_Ex1.java   |  8 ++------
 .../maps/spec_10_1_26_ex2/TestSpec10_1_26_Ex2.java   |  6 +++---
 .../maps/spec_10_1_26_ex3/TestSpec10_1_26_Ex3.java   |  2 +-
 .../maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java   |  2 +-
 .../jdbc/maps/spec_10_1_27_ex4/Company.java          |  3 +--
 .../maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java   | 10 +++++-----
 .../maps/spec_10_1_27_ex5/TestSpec10_1_27_Ex5.java   | 12 ++++++------
 .../maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java   | 10 +++++-----
 .../maps/spec_10_1_27_ex7/TestSpec10_1_27_Ex7.java   | 12 ++++++------
 .../maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java   | 15 +++++++++------
 .../maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java   | 10 +++++-----
 .../maps/spec_10_1_29_ex3/TestSpec10_1_29_Ex3.java   | 14 +++++++-------
 24 files changed, 91 insertions(+), 97 deletions(-)

diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java
index b524253..54504c0 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheOptimisticLockRecovery.java
@@ -94,11 +94,7 @@ public class TestDataCacheOptimisticLockRecovery
         // via direct SQL in a separate transaction
         int secondOpLockValue = firstOpLockValue + 1;
 
-        OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI)
-            OpenJPAPersistence.cast(em).getEntityManagerFactory();
-        DataSource ds = (DataSource) emf.getConfiguration()
-            .getConnectionFactory();
-        Connection c = ds.getConnection();
+        Connection c = (Connection)OpenJPAPersistence.cast(em).getConnection();
         c.setAutoCommit(false);
         PreparedStatement ps = c.prepareStatement(
             "UPDATE OPTIMISTIC_LOCK_INSTANCE SET OPLOCK = ? WHERE PK = ?");
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex0/TestMany2ManyMap.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex0/TestMany2ManyMap.java
index 095ecc6..9c5d77d 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex0/TestMany2ManyMap.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex0/TestMany2ManyMap.java
@@ -54,8 +54,8 @@ public class TestMany2ManyMap extends SQLListenerTestCase {
         super.setUp(CLEAR_TABLES, Division.class,
             Employee.class, PhoneNumber.class);
         createObj();
-       	rsAllPhones = getAll(PhoneNumber.class);
-       	rsAllEmps = getAll(Employee.class);
+        rsAllPhones = getAll(PhoneNumber.class);
+        rsAllEmps = getAll(Employee.class);
     }
     @AllowFailure
     public void testQueryInMemoryQualifiedId() throws Exception {
@@ -81,7 +81,7 @@ public class TestMany2ManyMap extends SQLListenerTestCase {
 
         // test navigation thru VALUE
         String query = "select VALUE(e).empId from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -89,7 +89,7 @@ public class TestMany2ManyMap extends SQLListenerTestCase {
 
         // test navigation thru KEY
         query = "select KEY(e), KEY(e).name from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -99,7 +99,7 @@ public class TestMany2ManyMap extends SQLListenerTestCase {
         assertEquals(d0.getName(), name);
 
         query = "select KEY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -107,7 +107,7 @@ public class TestMany2ManyMap extends SQLListenerTestCase {
         Division d = (Division) rs.get(0);
 
         query = "select KEY(p) from Employee e, " +
-            " in (e.phones) p";
+            " in (e.phones) p order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Employee.class);
@@ -115,7 +115,7 @@ public class TestMany2ManyMap extends SQLListenerTestCase {
         Division d2 = (Division) rs.get(0);
 
         query = "select VALUE(e) from PhoneNumber p, " +
-            " in (p.emps) e";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -123,17 +123,17 @@ public class TestMany2ManyMap extends SQLListenerTestCase {
         Employee e = (Employee) rs.get(0);
         em.clear();
         query = "select ENTRY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         query = "select TYPE(KEY(p)) from Employee e, " +
-            " in (e.phones) p";
+            " in (e.phones) p  order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Employee.class);
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java
index 6ced5ff..82750df 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java
@@ -89,7 +89,7 @@ public class TestMany2ManyMapEx1 extends SQLListenerTestCase {
     public void queryQualifiedId(boolean inMemory) throws Exception {
         EntityManager em = emf.createEntityManager();
         String query = "select KEY(e), p from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -98,7 +98,7 @@ public class TestMany2ManyMapEx1 extends SQLListenerTestCase {
         PhoneNumber p = (PhoneNumber) ((Object[]) rs.get(0))[1];
 
         query = "select KEY(p) from Employee e, " +
-                " in (e.phones) p";
+                " in (e.phones) p order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Employee.class);
@@ -107,7 +107,7 @@ public class TestMany2ManyMapEx1 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -121,7 +121,7 @@ public class TestMany2ManyMapEx1 extends SQLListenerTestCase {
         // test navigation thru KEY
         em.clear();
         query = "select KEY(e), KEY(e).name from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -132,7 +132,7 @@ public class TestMany2ManyMapEx1 extends SQLListenerTestCase {
 
         em.clear();
         query = "select KEY(p), KEY(p).name from Employee e, " +
-            " in (e.phones) p";
+            " in (e.phones) p order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Employee.class);
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex10/TestMany2ManyMapEx10.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex10/TestMany2ManyMapEx10.java
index 52a80b9..62e7c10 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex10/TestMany2ManyMapEx10.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex10/TestMany2ManyMapEx10.java
@@ -126,7 +126,7 @@ public class TestMany2ManyMapEx10 extends SQLListenerTestCase {
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         // test navigation thru KEY
         em.clear();
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex2/TestMany2ManyMapEx2.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex2/TestMany2ManyMapEx2.java
index 0b9e562..574f163 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex2/TestMany2ManyMapEx2.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex2/TestMany2ManyMapEx2.java
@@ -108,7 +108,7 @@ public class TestMany2ManyMapEx2 extends SQLListenerTestCase {
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         query = "select KEY(e) from PhoneNumber p, " +
             " in (p.emps) e WHERE value(e).empId = 1 and KEY(e) = 'String1'";
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex3/TestMany2ManyMapEx3.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex3/TestMany2ManyMapEx3.java
index 883ba32..ed237ec 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex3/TestMany2ManyMapEx3.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex3/TestMany2ManyMapEx3.java
@@ -112,7 +112,7 @@ public class TestMany2ManyMapEx3 extends SQLListenerTestCase {
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         // test navigation thru KEY
         em.clear();
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex4/TestMany2ManyMapEx4.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex4/TestMany2ManyMapEx4.java
index 749edc0..773d17c 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex4/TestMany2ManyMapEx4.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex4/TestMany2ManyMapEx4.java
@@ -96,7 +96,7 @@ public class TestMany2ManyMapEx4 extends SQLListenerTestCase {
         EntityManager em = emf.createEntityManager();
         // a collection valued path thru KEY in FROM clause
         String query = "select o.address.city from PhoneNumber p, " +
-            " in (p.emps) e, in(KEY(e).offices) o";
+            " in (p.emps) e, in(KEY(e).offices) o order by o.address.city";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -113,14 +113,14 @@ public class TestMany2ManyMapEx4 extends SQLListenerTestCase {
         // a path thru KEY nagivation apprear in WHERE clause
         query = "select o.address.city as city from PhoneNumber p, " +
             " in (p.emps) e, in(KEY(e).offices) o " +
-            " where o.address.city like '%1'";
+            " where o.address.city like '%1' order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
         rs = q.getResultList();
 
         query = "select KEY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -128,7 +128,7 @@ public class TestMany2ManyMapEx4 extends SQLListenerTestCase {
         Division d = (Division) rs.get(0);
 
         query = "select KEY(p) from Employee e, " +
-            " in (e.phones) p";
+            " in (e.phones) p order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Employee.class);
@@ -137,14 +137,14 @@ public class TestMany2ManyMapEx4 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.close();
     }
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex5/TestMany2ManyMapEx5.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex5/TestMany2ManyMapEx5.java
index e738cb0..33bbe6f 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex5/TestMany2ManyMapEx5.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex5/TestMany2ManyMapEx5.java
@@ -114,7 +114,7 @@ public class TestMany2ManyMapEx5 extends SQLListenerTestCase {
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         query = "select p from PhoneNumber p," +
             " in (p.emps) e where Key(e) = 'String2' order by p.number";
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex6/TestMany2ManyMapEx6.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex6/TestMany2ManyMapEx6.java
index fba3d77..209085c 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex6/TestMany2ManyMapEx6.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex6/TestMany2ManyMapEx6.java
@@ -116,7 +116,7 @@ public class TestMany2ManyMapEx6 extends SQLListenerTestCase {
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         // test GROUP BY qualified path
         sql.clear();
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex7/TestMany2ManyMapEx7.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex7/TestMany2ManyMapEx7.java
index 006ded3..0eb4fce 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex7/TestMany2ManyMapEx7.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex7/TestMany2ManyMapEx7.java
@@ -92,7 +92,7 @@ public class TestMany2ManyMapEx7 extends SQLListenerTestCase {
     public void queryQualifiedId(boolean inMemory) throws Exception {
         EntityManager em = emf.createEntityManager();
         String query = "select KEY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -100,7 +100,7 @@ public class TestMany2ManyMapEx7 extends SQLListenerTestCase {
         Division d = (Division) rs.get(0);
 
         query = "select KEY(p) from Employee e, " +
-            " in (e.phones) p";
+            " in (e.phones) p order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Employee.class);
@@ -109,14 +109,14 @@ public class TestMany2ManyMapEx7 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.close();
     }
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex8/TestMany2ManyMapEx8.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex8/TestMany2ManyMapEx8.java
index fd025f1..142efa9 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex8/TestMany2ManyMapEx8.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex8/TestMany2ManyMapEx8.java
@@ -89,7 +89,7 @@ public class TestMany2ManyMapEx8 extends SQLListenerTestCase {
     public void queryQualifiedId(boolean inMemory) throws Exception {
         EntityManager em = emf.createEntityManager();
         String query = "select KEY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -97,7 +97,7 @@ public class TestMany2ManyMapEx8 extends SQLListenerTestCase {
         String d = (String) rs.get(0);
 
         query = "select KEY(p) from Employee e, " +
-            " in (e.phones) p";
+            " in (e.phones) p order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Employee.class);
@@ -106,19 +106,19 @@ public class TestMany2ManyMapEx8 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         // test KEY(e) of basic type in conditional expression
         sql.clear();
         query = "select KEY(e) from PhoneNumber p, " +
-            " in (p.emps) e where KEY(e) like '%1'";
+            " in (p.emps) e where KEY(e) like '%1' order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex9/TestMany2ManyMapEx9.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex9/TestMany2ManyMapEx9.java
index c57b349..efb9421 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex9/TestMany2ManyMapEx9.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex9/TestMany2ManyMapEx9.java
@@ -94,7 +94,7 @@ public class TestMany2ManyMapEx9 extends SQLListenerTestCase {
     public void queryQualifiedId(boolean inMemory) throws Exception {
         EntityManager em = emf.createEntityManager();
         String query = "select KEY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
@@ -102,7 +102,7 @@ public class TestMany2ManyMapEx9 extends SQLListenerTestCase {
         FullName d = (FullName) rs.get(0);
 
         query = "select KEY(p) from Employee e, " +
-            " in (e.phones) p";
+            " in (e.phones) p order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Employee.class);
@@ -111,14 +111,14 @@ public class TestMany2ManyMapEx9 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from PhoneNumber p, " +
-            " in (p.emps) e order by e.empId";
+            " in (p.emps) e order by p.number, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, PhoneNumber.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.close();
     }
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex1/TestSpec10_1_26_Ex1.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex1/TestSpec10_1_26_Ex1.java
index 011aa69..344bc6d 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex1/TestSpec10_1_26_Ex1.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex1/TestSpec10_1_26_Ex1.java
@@ -74,10 +74,6 @@ public class TestSpec10_1_26_Ex1 extends SQLListenerTestCase {
 
     public void queryQualifiedId(boolean inMemory) throws Exception {
         EntityManager em = emf.createEntityManager();
-        String query1 = "select d.deptId, KEY(e), VALUE(e).empId " +
-        "from Department d, in (d.empMap) e";
-List rs1 = em.createQuery(query1).getResultList();
-System.out.println("rs size="+rs1.size());
 
         String query = "select KEY(e) from Department d, " +
             " in (d.empMap) e order by d.deptId, e.empId";
@@ -96,12 +92,12 @@ System.out.println("rs size="+rs1.size());
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         // test KEY(e) of basic type in conditional expression
         sql.clear();
         query = "select KEY(e) from Department d, " +
-            " in (d.empMap) e where KEY(e) > 1";
+            " in (d.empMap) e where KEY(e) > 1 order by d.deptId, e.empId";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Department.class);
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex2/TestSpec10_1_26_Ex2.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex2/TestSpec10_1_26_Ex2.java
index a1970fa..84159dc 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex2/TestSpec10_1_26_Ex2.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex2/TestSpec10_1_26_Ex2.java
@@ -73,7 +73,7 @@ public class TestSpec10_1_26_Ex2 extends SQLListenerTestCase {
     public void queryQualifiedId(boolean inMemory) throws Exception {
         EntityManager em = emf.createEntityManager();
         String query = "select KEY(e), KEY(e).name from Department d, " +
-            " in (d.empMap) e where d.deptId = 1";
+            " in (d.empMap) e where d.deptId = 1 order by d.deptId, e.empPK";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Department.class);
@@ -84,14 +84,14 @@ public class TestSpec10_1_26_Ex2 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Department d, " +
-            " in (d.empMap) e  where d.deptId = 1";
+            " in (d.empMap) e  where d.deptId = 1 order by d.deptId, e.empPK";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Department.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         // test GROUP BY qualified path
         sql.clear();
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex3/TestSpec10_1_26_Ex3.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex3/TestSpec10_1_26_Ex3.java
index 0feead4..6b25b9b 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex3/TestSpec10_1_26_Ex3.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_26_ex3/TestSpec10_1_26_Ex3.java
@@ -92,7 +92,7 @@ public class TestSpec10_1_26_Ex3 extends SQLListenerTestCase {
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         // test ORDER BY qualified path
         query = "select KEY(e), KEY(e).fName from Department d, " +
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java
index 741c887..1d17d00 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java
@@ -121,7 +121,7 @@ public class TestSpec10_1_27_Ex3 extends SQLListenerTestCase {
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.close();
     }
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Company.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Company.java
index d4c111c..f3e9526 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Company.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Company.java
@@ -33,8 +33,7 @@ public class Company {
     int id;
 
     @OneToMany
-    Map<Division, VicePresident> organization =
-        new HashMap<>();
+    Map<Division, VicePresident> organization = new HashMap<>();
 
     public int getId() {
         return id;
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
index aff3d49..b62bf6a 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
@@ -81,7 +81,7 @@ public class TestSpec10_1_27_Ex4 extends SQLListenerTestCase {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e) from Company c, " +
-            " in (c.organization) e order by c.id";
+            " in (c.organization) e order by KEY(e).id";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -90,7 +90,7 @@ public class TestSpec10_1_27_Ex4 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c, " +
-            " in (c.organization) e order by c.id";
+            " in (c.organization) e order by KEY(e).id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -101,7 +101,7 @@ public class TestSpec10_1_27_Ex4 extends SQLListenerTestCase {
 
         em.clear();
         query = "select KEY(e) from Company c " +
-            " left join c.organization e order by c.id";
+            " left join c.organization e order by KEY(e).id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -110,13 +110,13 @@ public class TestSpec10_1_27_Ex4 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c " +
-            " left join c.organization e order by c.id";
+            " left join c.organization e order by KEY(e).id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.close();
     }
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex5/TestSpec10_1_27_Ex5.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex5/TestSpec10_1_27_Ex5.java
index 7817e79..e680f50 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex5/TestSpec10_1_27_Ex5.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex5/TestSpec10_1_27_Ex5.java
@@ -83,7 +83,7 @@ public class TestSpec10_1_27_Ex5 extends SQLListenerTestCase {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e) from Company c, " +
-            " in (c.orgs) e order by c.id";
+            " in (c.orgs) e order by c.id, e.id";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -92,18 +92,18 @@ public class TestSpec10_1_27_Ex5 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c, " +
-            " in (c.orgs) e order by c.id";
+            " in (c.orgs) e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.clear();
         query = "select KEY(e) from Company c " +
-            " left join c.orgs e order by c.id";
+            " left join c.orgs e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -112,13 +112,13 @@ public class TestSpec10_1_27_Ex5 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c " +
-            " left join c.orgs e order by c.id";
+            " left join c.orgs e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.close();
     }
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java
index 67974e0..29f7741 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java
@@ -81,7 +81,7 @@ public class TestSpec10_1_27_Ex6 extends SQLListenerTestCase {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e) from Company c, " +
-            " in (c.organization) e order by c.id";
+            " in (c.organization) e order by c.id, e.id";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -90,7 +90,7 @@ public class TestSpec10_1_27_Ex6 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c, " +
-            " in (c.organization) e order by c.id";
+            " in (c.organization) e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -101,7 +101,7 @@ public class TestSpec10_1_27_Ex6 extends SQLListenerTestCase {
 
         em.clear();
         query = "select KEY(e) from Company c " +
-            " left join c.organization e order by c.id";
+            " left join c.organization e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -110,13 +110,13 @@ public class TestSpec10_1_27_Ex6 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c " +
-            " left join c.organization e order by c.id";
+            " left join c.organization e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.close();
     }
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex7/TestSpec10_1_27_Ex7.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex7/TestSpec10_1_27_Ex7.java
index f8fad0a..551db66 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex7/TestSpec10_1_27_Ex7.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex7/TestSpec10_1_27_Ex7.java
@@ -83,7 +83,7 @@ public class TestSpec10_1_27_Ex7 extends SQLListenerTestCase {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e) from Company c, " +
-            " in (c.orgs) e order by c.id";
+            " in (c.orgs) e order by c.id, e.id";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -92,18 +92,18 @@ public class TestSpec10_1_27_Ex7 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c, " +
-            " in (c.orgs) e order by c.id";
+            " in (c.orgs) e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.clear();
         query = "select KEY(e) from Company c " +
-            " left join c.orgs e order by c.id";
+            " left join c.orgs e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -112,13 +112,13 @@ public class TestSpec10_1_27_Ex7 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c " +
-            " left join c.orgs e order by c.id";
+            " left join c.orgs e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
 
         em.close();
     }
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java
index d770e27..e29df86 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java
@@ -33,6 +33,8 @@ import org.apache.openjpa.persistence.test.AllowFailure;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 
 import junit.framework.Assert;
+import static junit.framework.TestCase.assertEquals;
+import org.apache.openjpa.persistence.jdbc.maps.spec_10_1_27_ex6.Division;
 
 
 public class TestSpec10_1_27_Ex8 extends SQLListenerTestCase {
@@ -85,7 +87,7 @@ public class TestSpec10_1_27_Ex8 extends SQLListenerTestCase {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e), e from Company c, " +
-            " in (c.orgs) e order by c.id";
+            " in (c.orgs) e order by c.id, e.id";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -95,18 +97,18 @@ public class TestSpec10_1_27_Ex8 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c, " +
-            " in (c.orgs) e order by c.id";
+            " in (c.orgs) e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
         assertEquals(v.getId(), ((VicePresident) me.getValue()).getId());
 
         em.clear();
         query = "select KEY(e), e from Company c " +
-            " left join c.orgs e order by c.id";
+            " left join c.orgs e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -116,14 +118,15 @@ public class TestSpec10_1_27_Ex8 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c " +
-            " left join c.orgs e order by c.id";
+            " left join c.orgs e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d.getFName(), ((FileName) me.getKey()).getFName());
+        assertEquals(d.getLName(), ((FileName) me.getKey()).getLName());
 
         assertEquals(v.getId(), ((VicePresident) me.getValue()).getId());
 
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java
index ebc9cf3..52a2098 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java
@@ -79,7 +79,7 @@ public class TestSpec10_1_29_Ex1 extends SQLListenerTestCase {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e), e from Company c, " +
-            " in (c.organization) e order by c.id";
+            " in (c.organization) e order by c.id, e.id";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -98,18 +98,18 @@ public class TestSpec10_1_29_Ex1 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c, " +
-            " in (c.organization) e order by c.id";
+            " in (c.organization) e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
         assertEquals(v.getId(), ((VicePresident) me.getValue()).getId());
 
         em.clear();
         query = "select KEY(e), e from Company c " +
-            " left join c.organization e order by c.id";
+            " left join c.organization e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
@@ -119,7 +119,7 @@ public class TestSpec10_1_29_Ex1 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Company c " +
-            " left join c.organization e order by c.id";
+            " left join c.organization e order by c.id, e.id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Company.class);
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex3/TestSpec10_1_29_Ex3.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex3/TestSpec10_1_29_Ex3.java
index 24ebd31..6ea174e 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex3/TestSpec10_1_29_Ex3.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex3/TestSpec10_1_29_Ex3.java
@@ -78,7 +78,7 @@ public class TestSpec10_1_29_Ex3 extends SQLListenerTestCase {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e), e from Student s, " +
-            " in (s.enrollment) e order by s.id";
+            " in (s.enrollment) e order by s.id, KEY(e).id";
         Query q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Student.class);
@@ -88,19 +88,19 @@ public class TestSpec10_1_29_Ex3 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Student s, " +
-            " in (s.enrollment) e order by s.id";
+            " in (s.enrollment) e order by s.id, KEY(e).id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Student.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(c.equals(me.getKey()));
+        assertEquals(c, me.getKey());
         assertEquals(s.getId(), ((Semester) me.getValue()).getId());
 
         em.clear();
         query = "select KEY(e), e from Student s " +
-            " left join s.enrollment e order by s.id";
+            " left join s.enrollment e order by s.id, KEY(e).id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Student.class);
@@ -110,18 +110,18 @@ public class TestSpec10_1_29_Ex3 extends SQLListenerTestCase {
 
         em.clear();
         query = "select ENTRY(e) from Student s " +
-            " left join s.enrollment e order by s.id";
+            " left join s.enrollment e order by s.id, KEY(e).id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Student.class);
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
 
-        assertTrue(c.equals(me.getKey()));
+        assertEquals(c, me.getKey());
         assertEquals(s.getId(), ((Semester) me.getValue()).getId());
 
         query = "select KEY(e) from Student s " +
-            " join s.enrollment e WHERE KEY(e).id = 1 order by s.id";
+            " join s.enrollment e WHERE KEY(e).id = 1 order by s.id, KEY(e).id";
         q = em.createQuery(query);
         if (inMemory)
             setCandidate(q, Student.class);


Mime
View raw message