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 2020/08/31 13:03:08 UTC

[openjpa] branch 2.4.x updated: OPENJPA-2795 add documentation and PostgreSQL support

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

struberg pushed a commit to branch 2.4.x
in repository https://gitbox.apache.org/repos/asf/openjpa.git


The following commit(s) were added to refs/heads/2.4.x by this push:
     new 5346296  OPENJPA-2795 add documentation and PostgreSQL support
5346296 is described below

commit 534629642a3c276aa13d6160faa0feaab41477f8
Author: Mark Struberg <st...@apache.org>
AuthorDate: Mon Aug 31 15:02:23 2020 +0200

    OPENJPA-2795 add documentation and PostgreSQL support
    
    Postgres also doesn't automatically create a foreign key index.
---
 .../apache/openjpa/jdbc/sql/PostgresDictionary.java |  2 ++
 .../src/doc/manual/ref_guide_dbsetup.xml            | 21 +++++++++++++++++++++
 .../src/doc/manual/ref_guide_mapping.xml            |  7 +++++++
 3 files changed, 30 insertions(+)

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 bc4fe87..1484d16 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
@@ -225,6 +225,8 @@ public class PostgresDictionary
         _timestampTypes.add("ABSTIME");
         _timestampTypes.add("TIMESTAMP");
         _timestampTypes.add(timestampTypeName.toUpperCase(Locale.ENGLISH)); // handle user configured timestamp types.
+
+        indexPhysicalForeignKeys = true; // PostgreSQL does not automatically create an index for a foreign key so we will
     }
 
     @Override
diff --git a/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml b/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
index caeb3f5..d5ced20 100644
--- a/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
+++ b/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
@@ -1788,6 +1788,27 @@ works around cases where the limit is exceeded.  Defaults to -1 meaning
 no limit.
                     </para>
                 </listitem>
+
+                <listitem id="DBDictionary.IndexPhysicalForeignKeys">
+                    <para>
+                        <indexterm>
+                            <primary>
+                                DDL
+                            </primary>
+                            <secondary>
+                                IndexPhysicalForeignKeys
+                            </secondary>
+                        </indexterm>
+                        <literal>IndexPhysicalForeignKeys</literal>:
+                        Whether a search Index should automatically get created on a physical foreign key.
+                        Some databases, like MySQL, handle this internally, so we do not need to generate
+                        an explicit Index in our DDL. Other databases need an explicit serach index
+                        on foreign key columns to improve performance.
+
+                        IndexPhysicalForeignKeys defaults to true for Oracle, MS-SQL and PostgreSQL.
+                    </para>
+                </listitem>
+
                 <listitem id="DBDictionary.InitializationSQL">
                     <para>
                     <indexterm>
diff --git a/openjpa-project/src/doc/manual/ref_guide_mapping.xml b/openjpa-project/src/doc/manual/ref_guide_mapping.xml
index 6ee69fd..dcf8392 100644
--- a/openjpa-project/src/doc/manual/ref_guide_mapping.xml
+++ b/openjpa-project/src/doc/manual/ref_guide_mapping.xml
@@ -1186,6 +1186,13 @@ database foreign key. Defaults to true.
                     </listitem>
                     <listitem>
                         <para>
+<literal>IndexPhysicalForeignKeys</literal>: Boolean property controlling
+whether to create explicit indexes on real physical foreign keys.
+The default value will be taken from the corresponding <literal>DBDictionary</literal> attribute.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
 <literal>DataStoreIdColumnName</literal>: The default name of datastore
 identity columns.
                         </para>