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/04/02 16:00:20 UTC
[openjpa] branch master updated: OPENJPA-1303 "KEY" is also a
reserved word for columns
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
The following commit(s) were added to refs/heads/master by this push:
new 53cc83e OPENJPA-1303 "KEY" is also a reserved word for columns
53cc83e is described below
commit 53cc83eb7ee995aa3d645f7b4bdc6492f0e609d1
Author: Mark Struberg <st...@apache.org>
AuthorDate: Fri Apr 2 17:59:37 2021 +0200
OPENJPA-1303 "KEY" is also a reserved word for columns
---
.../apache/openjpa/jdbc/identifier/DBIdentifier.java | 14 --------------
.../java/org/apache/openjpa/jdbc/sql/H2Dictionary.java | 2 +-
.../org/apache/openjpa/jdbc/sql/PostgresDictionary.java | 2 +-
.../compat/TestSpecCompatibilityOptions.java | 17 ++---------------
4 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java
index 05fd32b..ea72753 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java
@@ -158,7 +158,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
/**
* Set the type of the identifier
- * @param type
*/
protected void setType(DBIdentifierType type) {
_type = type;
@@ -177,9 +176,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
* Splits a string delimited by the specified delimiter of a given name type
* into an array of DBIdentifier objects.
* Example: COL1|"COL 2"|COL3 delim=| --> DBIdentifier[]{ COL1, "COL 2", COL3 }
- * @param name
- * @param id
- * @param delim
*/
public static DBIdentifier[] split(String name, DBIdentifierType id, String delim) {
@@ -201,8 +197,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
/**
* Joins the list of identifiers using the appropriate delimiters and
* returns a string based identifier.
- * @param resultId
- * @param names
*/
public static String join(DBIdentifier...names) {
if (names == null || names.length == 0) {
@@ -810,7 +804,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
/**
* Equality operator which ignores case.
- * @param name
*/
public boolean equalsIgnoreCase(DBIdentifier name) {
return equals(name, true);
@@ -818,8 +811,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
/**
* Static equality operator which ignores case.
- * @param name
- * @return
*/
public static boolean equalsIgnoreCase(DBIdentifier name1, DBIdentifier name2) {
boolean name1Null = DBIdentifier.isNull(name1);
@@ -849,7 +840,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
/**
* Returns a new identifier with a combined prefix and name using the standard name
* concatenation character ('_').
- * @param prefix
*/
public static DBIdentifier preCombine(DBIdentifier name, String prefix) {
if (DBIdentifier.isNull(name)) {
@@ -864,7 +854,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
/**
* Returns a new identifier with delimiters removed.
- * @param name
*/
public static DBIdentifier removeDelimiters(DBIdentifier name) {
if (DBIdentifier.isNull(name) || !name.isDelimited()) {
@@ -883,8 +872,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
* Combine {@link #removeDelimiters(org.apache.openjpa.jdbc.identifier.DBIdentifier) }
* with {@link #toUpper(org.apache.openjpa.jdbc.identifier.DBIdentifier, boolean) }
* in order to save allocations and CPU cycles.
- * @param name
- * @return
*/
public static DBIdentifier removeDelimitersAndMakeUpper(DBIdentifier name) {
if (DBIdentifier.isNull(name) || name.getNameInternal() == null) {
@@ -901,7 +888,6 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
/**
* Returns a new delimiter with leading and trailing spaces removed.
- * @param name
*/
public static DBIdentifier trim(DBIdentifier name) {
if (DBIdentifier.isNull(name)) {
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 0ad08d9..fd218c8 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
@@ -127,7 +127,7 @@ public class H2Dictionary extends DBDictionary {
// reservedWordSet subset that CANNOT be used as valid column names
// (i.e., without surrounding them with double-quotes)
invalidColumnWordSet.addAll(Arrays.asList(new String[]{
- "ORDER",
+ "ORDER", "KEY",
}));
}
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
index 51e0537..3d93682 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
@@ -199,7 +199,7 @@ public class PostgresDictionary extends DBDictionary {
"CURRENT_TIMESTAMP", "CURRENT_USER", "DEFAULT", "DEFERRABLE",
"DESC", "DISTINCT", "DO", "ELSE", "END", "END", "EXCEPT", "FALSE",
"FOR", "FOREIGN", "FROM", "FULL", "GRANT", "GROUP", "HAVING", "IN",
- "INITIALLY", "INNER", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN",
+ "INITIALLY", "INNER", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY",
"LEADING", "LEFT", "LIKE", "NATURAL", "NOT", "NOTNULL", "NULL",
"ON", "ONLY", "OR", "ORDER", "OUTER", "OVERLAPS", "PRIMARY",
"REFERENCES", "RIGHT", "SELECT", "SESSION_USER", "SOME", "TABLE",
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestSpecCompatibilityOptions.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestSpecCompatibilityOptions.java
index 40f0982..64bb853 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestSpecCompatibilityOptions.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/compat/TestSpecCompatibilityOptions.java
@@ -51,8 +51,7 @@ extends AbstractCachedEMFTestCase {
OpenJPAEntityManagerFactorySPI emf =
(OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
createEntityManagerFactory("persistence_1_0",
- "org/apache/openjpa/persistence/compat/" +
- "persistence_1_0.xml");
+ "org/apache/openjpa/persistence/compat/persistence_1_0.xml");
try {
Compatibility compat = emf.getConfiguration().getCompatibilityInstance();
@@ -193,9 +192,6 @@ extends AbstractCachedEMFTestCase {
crudUni1MJT(em);
crudBi1MFK(em);
crudBi1MJT(em);
- } catch (Exception e) {
- e.printStackTrace();
- fail("OneToMany mapping failed with exception message: " + e.getMessage());
} finally {
em.close();
closeEMF(emf);
@@ -422,9 +418,6 @@ extends AbstractCachedEMFTestCase {
crudBi1MMapJT(em);
crudUni1MMapRelKeyFK(em);
crudBi1MMapRelKeyJT(em);
- } catch (Exception e) {
- e.printStackTrace();
- fail("OneToMany mapping failed with exception message: " + e.getMessage());
} finally {
em.close();
emf.close();
@@ -433,6 +426,7 @@ extends AbstractCachedEMFTestCase {
public void crudUni1MMapFK(EntityManager em) {
//create
+ em.getTransaction().begin();
Uni_1ToM_Map_FK u = new Uni_1ToM_Map_FK();
u.setName("u");
Map<String, EntityC_U1M_Map_FK> cs = new HashMap<>();
@@ -447,7 +441,6 @@ extends AbstractCachedEMFTestCase {
em.persist(u);
em.persist(c1);
em.persist(c2);
- em.getTransaction().begin();
em.getTransaction().commit();
//update by adding a new C
@@ -676,9 +669,6 @@ extends AbstractCachedEMFTestCase {
em.getTransaction().commit();
assertSQLFragnments(sql, "CREATE TABLE UniM1JT_C", "U_ID", "C_ID");
crudUniM1JT(em);
- } catch (Exception e) {
- e.printStackTrace();
- fail("ManyToOne mapping failed with exception message: " + e.getMessage());
} finally {
em.close();
emf.close();
@@ -752,9 +742,6 @@ extends AbstractCachedEMFTestCase {
assertSQLFragnments(sql, "CREATE TABLE Uni11JT_C", "U_ID", "C_ID");
crudBi11JT(em);
crudUni11JT(em);
- } catch (Exception e) {
- e.printStackTrace();
- fail("OneToOne mapping failed with exception message: " + e.getMessage());
} finally {
em.close();
emf.close();