You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by so...@apache.org on 2021/10/21 13:51:26 UTC

[openjpa] branch OPENJPA-2883 created (now 6893f84)

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

solomax pushed a change to branch OPENJPA-2883
in repository https://gitbox.apache.org/repos/asf/openjpa.git.


      at 6893f84  [OPENJPA-2883] test for the issue

This branch includes the following new commits:

     new 6893f84  [OPENJPA-2883] test for the issue

The 1 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.


[openjpa] 01/01: [OPENJPA-2883] test for the issue

Posted by so...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch OPENJPA-2883
in repository https://gitbox.apache.org/repos/asf/openjpa.git

commit 6893f84122d08e6753523f12af1ce1426d4bb970
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Thu Oct 21 20:51:07 2021 +0700

    [OPENJPA-2883] test for the issue
---
 .gitignore                                         |  1 +
 .../openjpa/jira_2883/TestOracleGeneratedId.java   | 72 ++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/.gitignore b/.gitignore
index bb0183f..38e2d26 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,5 @@ dependency-reduced-pom.xml
 .idea
 nb-configuration.xml
 nbactions*.xml
+.checkstyle
 
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira_2883/TestOracleGeneratedId.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira_2883/TestOracleGeneratedId.java
new file mode 100644
index 0000000..068738c
--- /dev/null
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jira_2883/TestOracleGeneratedId.java
@@ -0,0 +1,72 @@
+/*
+ * 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.jira_2883;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EntityManager;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+/**
+ * Tests that entity with generated id created as expected
+ *
+ *   <A HREF="https://issues.apache.org/jira/browse/OPENJPA-2883">OPENJPA-2883</A>
+ *
+ */
+public class TestOracleGeneratedId extends SingleEMFTestCase {
+    @Override
+    public void setUp() {
+        super.setUp(CLEAR_TABLES, OraGenIdData.class,
+                "openjpa.jdbc.DBDictionary", "oracle(UseTriggersForAutoAssign=true, MaxAutoAssignNameLength=28, BatchLimit=100)");
+    }
+
+    public void testGeneratedId() {
+        EntityManager em = emf.createEntityManager();
+        assertTrue("Should be created without issues", true);
+    }
+
+    /**
+     * Declares a Version field of unsupported type.
+     *
+     */
+    @Entity
+    @Table(name="GeneratedId")
+    public class OraGenIdData {
+        @Id
+        @GeneratedValue(strategy = GenerationType.IDENTITY)
+        @Column(name = "id")
+        private long id;
+
+        @Column(name = "value")
+        private String value;
+
+        public long getId() {
+            return id;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+}