openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openjpa] 01/02: fix weird equals error.
Date Sat, 03 Nov 2018 13:26:09 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 ba7b8493ca8dfe364a52b45939f43ec02c347b96
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Sat Nov 3 12:19:36 2018 +0100

    fix weird equals error.
    
    most probably happens on subclassing when access to _id
    doesn't getnerate the sequence. Happened randomly though.
    So not 100% sure to have fixed it that way :(
---
 .../persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java  | 5 +++--
 .../persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java  | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

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 6c06725..aff3d49 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
@@ -77,7 +77,7 @@ public class TestSpec10_1_27_Ex4 extends SQLListenerTestCase {
             qi.setCandidateCollection(rsAllCompany);
     }
 
-    public void queryQualifiedId(boolean inMemory) throws Exception {
+    private void queryQualifiedId(boolean inMemory) throws Exception {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e) from Company c, " +
@@ -96,7 +96,8 @@ public class TestSpec10_1_27_Ex4 extends SQLListenerTestCase {
             setCandidate(q, Company.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
-        assertEquals(d, me.getKey());
+        assertEquals(d.getId(), ((Division) me.getKey()).getId());
+        assertEquals(d.getName(), ((Division) me.getKey()).getName());
 
         em.clear();
         query = "select KEY(e) from Company c " +
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 eee5e24..67974e0 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
@@ -96,7 +96,8 @@ public class TestSpec10_1_27_Ex6 extends SQLListenerTestCase {
             setCandidate(q, Company.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d.getId(), ((Division) me.getKey()).getId());
+        assertEquals(d.getName(), ((Division) me.getKey()).getName());
 
         em.clear();
         query = "select KEY(e) from Company c " +


Mime
View raw message