You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by st...@apache.org on 2021/05/02 20:08:55 UTC
[openjpa] 01/02: OPENJPA-2866 fix identifier unit test
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 d78bfc47cb505aad70f1d7380df11dfa65440a8e
Author: Mark Struberg <st...@apache.org>
AuthorDate: Sun May 2 21:53:12 2021 +0200
OPENJPA-2866 fix identifier unit test
Oracle now supports IDENTITY columns since a very long time.
No need to rely on ancient index creation stuff.
---
.../openjpa/persistence/embed/TestEmbeddable.java | 39 ++--------------------
1 file changed, 2 insertions(+), 37 deletions(-)
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddable.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddable.java
index e19cc5f..a40e340 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddable.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddable.java
@@ -30,7 +30,6 @@ import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -41,10 +40,6 @@ import javax.persistence.PersistenceUnitUtil;
import javax.persistence.Query;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
-import org.apache.openjpa.jdbc.meta.MappingTool;
-import org.apache.openjpa.jdbc.meta.MappingTool.Flags;
-import org.apache.openjpa.jdbc.sql.DBDictionary;
-import org.apache.openjpa.jdbc.sql.OracleDictionary;
import org.apache.openjpa.persistence.ArgumentException;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
@@ -107,10 +102,6 @@ public class TestEmbeddable extends SQLListenerTestCase {
EntityA_Embed_Single_Coll.class, Embed_Single_Coll.class, EntityA_Embed.class,
EntityA_Embed_Complex.class, A.class, CLEAR_TABLES);
sql.clear();
- DBDictionary dict = ((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance();
- if (dict.getClass().getName().toLowerCase(Locale.ENGLISH).indexOf("oracle") != -1) {
- ((OracleDictionary)dict).useTriggersForAutoAssign = true;
- }
}
public void testGroupByEmbed() {
@@ -2786,14 +2777,9 @@ public class TestEmbeddable extends SQLListenerTestCase {
*/
public void createEmbeddableContainingRelationWithGeneratedKey()
throws IOException, SQLException {
- EntityManager em = emf.createEntityManager();
-
- OpenJPAEntityManagerSPI ojem = (OpenJPAEntityManagerSPI)em;
+ OpenJPAEntityManagerSPI ojem = emf.createEntityManager();
+ EntityManager em = ojem;
JDBCConfiguration conf = (JDBCConfiguration) ojem.getConfiguration();
- DBDictionary dict = conf.getDBDictionaryInstance();
- if (dict instanceof OracleDictionary) {
- recreateOracleArtifacts((OracleDictionary)dict, conf);
- }
EntityTransaction tran = em.getTransaction();
Book b = new Book(1590596455);
@@ -2819,27 +2805,6 @@ public class TestEmbeddable extends SQLListenerTestCase {
}
/*
- * This method uses the mapping tool to regenerate Oracle db artifacts
- * with the useTriggersForAutoAssign db option enabled.
- */
- private void recreateOracleArtifacts(OracleDictionary dict,
- JDBCConfiguration conf) throws IOException, SQLException {
- dict.useTriggersForAutoAssign = true;
- Flags flags = new MappingTool.Flags();
- flags.dropTables = true;
- flags.schemaAction = "drop,add";
- flags.sequences = true;
- flags.ignoreErrors = true;
- flags.dropSequences = true;
- MappingTool.run(
- conf,
- new String[] { "org.apache.openjpa.persistence.embed.Book" },
- flags,
- conf.getClassResolverInstance().
- getClassLoader(MappingTool.class, null));
- }
-
- /*
* EntityA_Embed_Complex routines
*/
public void testEntityA_Embed_Complex() {