[openjpa] branch master updated (af39516 -> 6e8c4d9)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[openjpa] branch master updated (af39516 -> 6e8c4d9)

struberg
This is an automated email from the ASF dual-hosted git repository.

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


    from af39516  OPENJPA-2713 add java8 time support for h2
     new 4b88b80  remove obsolete sql tracing
     new 11863ed  OPENJPA-2772 update list of h2 resorved words
     new 6e8c4d9  fix broken unit test. Illegal table 'ROLES'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/openjpa/jdbc/sql/H2Dictionary.java  |  51 ++++++-
 .../org/apache/openjpa/persistence/query/Role.java |   2 +-
 .../persistence/query/TestEJBQueryInterface.java   |   2 +-
 .../persistence/query/TestOutOfBoundsEx.java       | 153 +++++++++++----------
 4 files changed, 123 insertions(+), 85 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[openjpa] 01/03: remove obsolete sql tracing

struberg
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 4b88b80dc05bd32893140e197feee1de702168db
Author: Mark Struberg <[hidden email]>
AuthorDate: Sat Feb 2 13:47:53 2019 +0100

    remove obsolete sql tracing
---
 .../org/apache/openjpa/persistence/query/TestEJBQueryInterface.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestEJBQueryInterface.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestEJBQueryInterface.java
index e90c22a..2d85966 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestEJBQueryInterface.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestEJBQueryInterface.java
@@ -33,7 +33,7 @@ public class TestEJBQueryInterface extends BaseQueryTest {
 
     @Override
     public void setUp() throws Exception {
-        super.setUp(Entity1.class, Entity2.class, Order.class, OrderItem.class, "openjpa.Log", "SQL=Trace");
+        super.setUp(Entity1.class, Entity2.class, Order.class, OrderItem.class);
 
         int instNum = 10;
 

Reply | Threaded
Open this post in threaded view
|

[openjpa] 02/03: OPENJPA-2772 update list of h2 resorved words

struberg
In reply to this post by struberg
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 11863ed9327c70420c2a537dafa380d3fee7b548
Author: Mark Struberg <[hidden email]>
AuthorDate: Sat Feb 2 13:48:22 2019 +0100

    OPENJPA-2772 update list of h2 resorved words
---
 .../org/apache/openjpa/jdbc/sql/H2Dictionary.java  | 51 +++++++++++++++++++---
 1 file changed, 44 insertions(+), 7 deletions(-)

diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/H2Dictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/H2Dictionary.java
index 095e742..0ad08d9 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/H2Dictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/H2Dictionary.java
@@ -79,13 +79,50 @@ public class H2Dictionary extends DBDictionary {
         timeWithZoneTypeName = "TIME";
 
         reservedWordSet.addAll(Arrays.asList(new String[] {
-            "CURRENT_TIMESTAMP", "CURRENT_TIME", "CURRENT_DATE", "CROSS",
-            "DISTINCT", "EXCEPT", "EXISTS", "FROM", "FOR", "FALSE", "FULL",
-            "GROUP", "HAVING", "INNER", "INTERSECT", "IS", "JOIN", "LIKE",
-            "MINUS", "NATURAL", "NOT", "NULL", "ON", "ORDER", "PRIMARY",
-            "ROWNUM", "SELECT", "SYSDATE", "SYSTIME", "SYSTIMESTAMP", "TODAY",
-            "TRUE", "UNION", "WHERE"
-            }));
+                "ALL",
+                "CHECK",
+                "CONSTRAINT",
+                "CROSS",
+                "CURRENT_DATE",
+                "CURRENT_TIME",
+                "CURRENT_TIMESTAMP",
+                "DISTINCT",
+                "EXCEPT",
+                "EXISTS",
+                "FALSE",
+                "FETCH",
+                "FOR",
+                "FOREIGN",
+                "FROM",
+                "FULL",
+                "GROUP",
+                "HAVING",
+                "INNER",
+                "INTERSECT",
+                "IS",
+                "JOIN",
+                "LIKE",
+                "LIMIT",
+                "MINUS",
+                "NATURAL",
+                "NOT",
+                "NULL",
+                "OFFSET",
+                "ON",
+                "ORDER",
+                "PRIMARY",
+                "ROWNUM",
+                "SELECT",
+                "SYSDATE",
+                "SYSTIME",
+                "SYSTIMESTAMP",
+                "TODAY",
+                "TRUE",
+                "UNION",
+                "UNIQUE",
+                "WHERE",
+                "WITH"
+        }));
 
         // reservedWordSet subset that CANNOT be used as valid column names
         // (i.e., without surrounding them with double-quotes)

Reply | Threaded
Open this post in threaded view
|

[openjpa] 03/03: fix broken unit test. Illegal table 'ROLES'

struberg
In reply to this post by struberg
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 6e8c4d987fa0f2364d880f8fab4c5d85f790f538
Author: Mark Struberg <[hidden email]>
AuthorDate: Sat Feb 2 13:49:27 2019 +0100

    fix broken unit test. Illegal table 'ROLES'
   
    The ROLES table exists by default in some datbases.
    So it's probably better to not use it as table name in our unit test.
---
 .../org/apache/openjpa/persistence/query/Role.java |   2 +-
 .../persistence/query/TestOutOfBoundsEx.java       | 153 +++++++++++----------
 2 files changed, 78 insertions(+), 77 deletions(-)

diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/Role.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/Role.java
index 6cd4eee..3ea0d45 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/Role.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/Role.java
@@ -28,7 +28,7 @@ import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 
 @Entity
-@Table(name = "roles")
+@Table(name = "rolesx")
 public class Role {
 
     @Id
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestOutOfBoundsEx.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestOutOfBoundsEx.java
index 45c414c..85d2738 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestOutOfBoundsEx.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestOutOfBoundsEx.java
@@ -30,82 +30,83 @@ import org.apache.openjpa.persistence.QueryImpl;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
 public class TestOutOfBoundsEx extends SingleEMFTestCase {
- private EntityManager em = null;
- private Lookup lookup;
+    private EntityManager em = null;
+    private Lookup lookup;
 
- @Override
+    @Override
     public void setUp() throws Exception {
- super.setUp(Lookup.class, Case.class, Role.class, ScheduledAssignment.class, ScheduleDay.class,
-        DROP_TABLES);
- em = emf.createEntityManager();
- insertLookups();
- }
-
- public void testOutOfBounds() throws Exception {
- Calendar cal = Calendar.getInstance();
- final Date date = cal.getTime();
- ScheduleDay sd = insertScheduleDay(date);
-
- Role role1 = insertJob();
- Role role2 = insertJob();
- Case kase1 = insertCase(sd);
- Case kase2 = insertCase(sd);
- insertScheduledAssignmentInCase(role1, kase2);
-
- // simulate new web transaction on different em
- em.close();
- em = emf.createEntityManager();
-
- Query query = em.createQuery("select o from Case as o" +
- " where o.scheduleDay = :sd");
- query.setParameter("sd", sd);
- FetchPlan fetchPlan = ((QueryImpl) query).getFetchPlan();
- fetchPlan.addField(Case.class, "scheduledAssignments");
-
- //Without the changes of OJ1424, this next call would cause an
- //ArrayIndexOutOfBoundsException.
- List<Case> allCases = query.getResultList();
- }
-
- public void insertLookups() {
- lookup = new Lookup();
- lookup.setName("XYZ");
- lookup.setId(1);
- save(lookup);
- }
-
- public void save(Object obj) {
- em.getTransaction().begin();
- em.persist(obj);
- em.getTransaction().commit();
- }
-
- public Role insertJob() {
- Role role = new Role();
- role.setLookup(lookup);
- save(role);
- return role;
- }
-
- public Case insertCase(ScheduleDay sd) throws Exception {
- Case kase = new Case();
- kase.setScheduleDay(sd);
- save(kase);
- return kase;
- }
-
- public void insertScheduledAssignmentInCase(Role job, Case kase) {
- ScheduledAssignment sa = new ScheduledAssignment();
- sa.setRole(job);
- sa.setCase(kase);
- sa.setScheduleDay(kase.getScheduleDay());
- save(sa);
- }
-
- public ScheduleDay insertScheduleDay(Date date) {
- ScheduleDay sd = new ScheduleDay();
- sd.setDate(date);
- save(sd);
- return sd;
- }
+        super.setUp(DROP_TABLES, Lookup.class, Case.class, Role.class,
+                ScheduledAssignment.class, ScheduleDay.class,
+                "openjpa.Log", "SQL=Trace");
+        em = emf.createEntityManager();
+        insertLookups();
+    }
+
+    public void testOutOfBounds() throws Exception {
+        Calendar cal = Calendar.getInstance();
+        final Date date = cal.getTime();
+        ScheduleDay sd = insertScheduleDay(date);
+
+        Role role1 = insertJob();
+        Role role2 = insertJob();
+        Case kase1 = insertCase(sd);
+        Case kase2 = insertCase(sd);
+        insertScheduledAssignmentInCase(role1, kase2);
+
+        // simulate new web transaction on different em
+        em.close();
+        em = emf.createEntityManager();
+
+        Query query = em.createQuery("select o from Case as o" +
+                " where o.scheduleDay = :sd");
+        query.setParameter("sd", sd);
+        FetchPlan fetchPlan = ((QueryImpl) query).getFetchPlan();
+        fetchPlan.addField(Case.class, "scheduledAssignments");
+
+        //Without the changes of OJ1424, this next call would cause an
+        //ArrayIndexOutOfBoundsException.
+        List<Case> allCases = query.getResultList();
+    }
+
+    public void insertLookups() {
+        lookup = new Lookup();
+        lookup.setName("XYZ");
+        lookup.setId(1);
+        save(lookup);
+    }
+
+    public void save(Object obj) {
+        em.getTransaction().begin();
+        em.persist(obj);
+        em.getTransaction().commit();
+    }
+
+    public Role insertJob() {
+        Role role = new Role();
+        role.setLookup(lookup);
+        save(role);
+        return role;
+    }
+
+    public Case insertCase(ScheduleDay sd) throws Exception {
+        Case kase = new Case();
+        kase.setScheduleDay(sd);
+        save(kase);
+        return kase;
+    }
+
+    public void insertScheduledAssignmentInCase(Role job, Case kase) {
+        ScheduledAssignment sa = new ScheduledAssignment();
+        sa.setRole(job);
+        sa.setCase(kase);
+        sa.setScheduleDay(kase.getScheduleDay());
+        save(sa);
+    }
+
+    public ScheduleDay insertScheduleDay(Date date) {
+        ScheduleDay sd = new ScheduleDay();
+        sd.setDate(date);
+        save(sd);
+        return sd;
+    }
 }