[jira] [Commented] (CAY-2600) Modeler DbImport: Can't retrieve schema for databases with no catalog support

2019-08-15 Thread Arseni Bulatski (JIRA)


[ 
https://issues.apache.org/jira/browse/CAY-2600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16908003#comment-16908003
 ] 

Arseni Bulatski commented on CAY-2600:
--

*4.1* 
[https://github.com/apache/cayenne/commit/fc52cf219e9fb01f8e72e7bd9e0467af24c2a3b0]

*4.2* 
[https://github.com/apache/cayenne/commit/285d75237d8b0659771c2f219562b57397f19f02]

One case was left. I'm not sure that it really exists.

According to JDBC specifications if user sets null to catalog or schema filter, 
database should return all catalogs or schemas.

But if there is some database what doesn't follow this specification and 
requires not null catalog and schema at the same time probably some bug will 
appear.

But it looks like something extraordinary. 

> Modeler DbImport: Can't retrieve schema for databases with no catalog support
> -
>
> Key: CAY-2600
> URL: https://issues.apache.org/jira/browse/CAY-2600
> Project: Cayenne
>  Issue Type: Bug
>Affects Versions: 4.1.B2
>Reporter: Andrus Adamchik
>Priority: Major
> Fix For: 4.1.B3, 4.2.M1
>
>
> I am trying to db-import model for Hana DB. DB Import itself ("Run Import" 
> button) works, if I manually add all the settings. However "Refresh DB 
> Schema" button results in an empty schema. 
> The cause of it seems to be the implementation of DatabaseSchemaLoader.load 
> method. It looks for catalogs, and if none found, returns an empty result. 
> Hana does not support catalogs, but supports schemas. And we need to support 
> this case.
> I guess in general we need to support all combinations of schema and catalog 
> presence across different databases:
> 1. Schema and Catalog (?)
> 2. Catalog only (MySQL)
> 3. Schema only (Hana ... who else?)
> 4. No schema or catalog (any DBs like this?)



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (CAY-2600) Modeler DbImport: Can't retrieve schema for databases with no catalog support

2019-08-15 Thread Andrus Adamchik (JIRA)


[ 
https://issues.apache.org/jira/browse/CAY-2600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16908072#comment-16908072
 ] 

Andrus Adamchik commented on CAY-2600:
--

[~aarrsseni] Great. I am going to try it on Hana and MySQL soon. Curious which 
databases we were able to test this with?

> Modeler DbImport: Can't retrieve schema for databases with no catalog support
> -
>
> Key: CAY-2600
> URL: https://issues.apache.org/jira/browse/CAY-2600
> Project: Cayenne
>  Issue Type: Bug
>Affects Versions: 4.1.B2
>Reporter: Andrus Adamchik
>Priority: Major
> Fix For: 4.1.B3, 4.2.M1
>
>
> I am trying to db-import model for Hana DB. DB Import itself ("Run Import" 
> button) works, if I manually add all the settings. However "Refresh DB 
> Schema" button results in an empty schema. 
> The cause of it seems to be the implementation of DatabaseSchemaLoader.load 
> method. It looks for catalogs, and if none found, returns an empty result. 
> Hana does not support catalogs, but supports schemas. And we need to support 
> this case.
> I guess in general we need to support all combinations of schema and catalog 
> presence across different databases:
> 1. Schema and Catalog (?)
> 2. Catalog only (MySQL)
> 3. Schema only (Hana ... who else?)
> 4. No schema or catalog (any DBs like this?)



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[GitHub] [cayenne] stariy95 closed pull request #400: CAY-2604 Specialization of property API for PK

2019-08-15 Thread GitBox
stariy95 closed pull request #400: CAY-2604 Specialization of property API for 
PK
URL: https://github.com/apache/cayenne/pull/400
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Updated] (CAY-2498) Rename packages to prevent crossing package names

2019-08-15 Thread Arseni Bulatski (JIRA)


 [ 
https://issues.apache.org/jira/browse/CAY-2498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Arseni Bulatski updated CAY-2498:
-
Description: 
Need to rename packages to prevent crossing package names when using java 
modularity.

Conflicts were found between:

1) cayenne-project-compatibility and cayenne-server

2) cayenne-rop-server and cayenne-server

3) cayenne-client and cayenne-client-jetty

4) cayenne-server and cayenne-dbcp2

5) cayenne-server and jgroups, jms, xmpp

6) cayenne-protostuff and cayenne-server

  was:
Need to rename packages to prevent crossing package names when using java 
modularity.

Conflicts were found between:

1) cayenne-project-compatibility and cayenne-server

2) cayenne-rap-server and cayenne-server

3) cayenne-client and cayenne-client-jetty

4) cayenne-server and cayenne-dbcp2

5) cayenne-server and jgroups, jms, xmpp

6) cayenne-protostuff and cayenne-server


> Rename packages to prevent crossing package names
> -
>
> Key: CAY-2498
> URL: https://issues.apache.org/jira/browse/CAY-2498
> Project: Cayenne
>  Issue Type: Task
>  Components: Core Library, ROP
>Reporter: Arseni Bulatski
>Priority: Major
> Fix For: 4.2.M1
>
>
> Need to rename packages to prevent crossing package names when using java 
> modularity.
> Conflicts were found between:
> 1) cayenne-project-compatibility and cayenne-server
> 2) cayenne-rop-server and cayenne-server
> 3) cayenne-client and cayenne-client-jetty
> 4) cayenne-server and cayenne-dbcp2
> 5) cayenne-server and jgroups, jms, xmpp
> 6) cayenne-protostuff and cayenne-server



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (CAY-2600) Modeler DbImport: Can't retrieve schema for databases with no catalog support

2019-08-15 Thread Arseni Bulatski (JIRA)


[ 
https://issues.apache.org/jira/browse/CAY-2600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16908088#comment-16908088
 ] 

Arseni Bulatski commented on CAY-2600:
--

[~andrus] I tried it on Oracle db what behavior is similar to Hana, I mean 
Oracle also has only schemas. And it works. Hope on Hana it will work too.

Also run on Postgres and on MySQL. 

> Modeler DbImport: Can't retrieve schema for databases with no catalog support
> -
>
> Key: CAY-2600
> URL: https://issues.apache.org/jira/browse/CAY-2600
> Project: Cayenne
>  Issue Type: Bug
>Affects Versions: 4.1.B2
>Reporter: Andrus Adamchik
>Priority: Major
> Fix For: 4.1.B3, 4.2.M1
>
>
> I am trying to db-import model for Hana DB. DB Import itself ("Run Import" 
> button) works, if I manually add all the settings. However "Refresh DB 
> Schema" button results in an empty schema. 
> The cause of it seems to be the implementation of DatabaseSchemaLoader.load 
> method. It looks for catalogs, and if none found, returns an empty result. 
> Hana does not support catalogs, but supports schemas. And we need to support 
> this case.
> I guess in general we need to support all combinations of schema and catalog 
> presence across different databases:
> 1. Schema and Catalog (?)
> 2. Catalog only (MySQL)
> 3. Schema only (Hana ... who else?)
> 4. No schema or catalog (any DBs like this?)



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[cayenne] branch master updated: CAY-2600 Modeler DbImport: Can't retrieve schema for databases with no catalog support

2019-08-15 Thread abulatski
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
 new 285d752  CAY-2600 Modeler DbImport: Can't retrieve schema for 
databases with no catalog support
285d752 is described below

commit 285d75237d8b0659771c2f219562b57397f19f02
Author: Arseni Bulatski 
AuthorDate: Thu Aug 15 14:05:42 2019 +0300

CAY-2600 Modeler DbImport: Can't retrieve schema for databases with no 
catalog support
---
 RELEASE-NOTES.txt  |   1 +
 .../editor/dbimport/DatabaseSchemaLoader.java  | 179 -
 .../modeler/editor/dbimport/DbImportTree.java  |  48 --
 3 files changed, 138 insertions(+), 90 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 47cf85c..5b4c2e6 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -75,6 +75,7 @@ CAY-2591 Modeler: project becomes dirty after click on 
dbImport or cgen tab
 CAY-2594 DbImport: AutoAdapter resolving inside an import operation hangs up 
the op on Hana DB
 CAY-2595 ObjAttributes are not sorted in alphabetical ordering on save
 CAY-2596 DbImport xml config changes after dbImport plugin task execution
+CAY-2600 Modeler DbImport: Can't retrieve schema for databases with no catalog 
support
 CAY-2601 Modeler DbImport: result dialog issues
 CAY-2603 NPE reloading project in the model
 CAY-2605 Modeler: Unable to save - java.nio.file.InvalidPathException
diff --git 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/DatabaseSchemaLoader.java
 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/DatabaseSchemaLoader.java
index c904843..5275238 100644
--- 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/DatabaseSchemaLoader.java
+++ 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/DatabaseSchemaLoader.java
@@ -26,18 +26,19 @@ import java.sql.SQLException;
 import java.util.Collection;
 
 import org.apache.cayenne.dbsync.reverse.dbimport.Catalog;
+import org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer;
 import org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn;
 import org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure;
 import org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable;
 import org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering;
 import org.apache.cayenne.dbsync.reverse.dbimport.Schema;
 import org.apache.cayenne.modeler.ClassLoadingService;
+import org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode;
 import org.apache.cayenne.modeler.pref.DBConnectionInfo;
 
 public class DatabaseSchemaLoader {
 
 private static final String INCLUDE_ALL_PATTERN = "%";
-private static final String EMPTY_DEFAULT_CATALOG = "";
 private static final int TABLE_INDEX = 3;
 private static final int SCHEMA_INDEX = 2;
 private static final int CATALOG_INDEX = 1;
@@ -56,36 +57,82 @@ public class DatabaseSchemaLoader {
 tableTypesFromConfig :
 new String[]{"TABLE", "VIEW", "SYSTEM TABLE",
 "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", 
"SYNONYM"};
-try (ResultSet rs = connection.getMetaData().getCatalogs()) {
-String defaultCatalog = connection.getCatalog();
-while (rs.next()) {
-ResultSet resultSet;
-if (defaultCatalog.equals(EMPTY_DEFAULT_CATALOG)) {
-resultSet = connection.getMetaData()
-.getTables(rs.getString(1), null, 
INCLUDE_ALL_PATTERN, types);
-} else {
-resultSet = connection.getMetaData()
-.getTables(defaultCatalog, null, 
INCLUDE_ALL_PATTERN, types);
-}
-String tableName = "";
-String schemaName = "";
-String catalogName = "";
-while (resultSet.next()) {
-tableName = resultSet.getString(TABLE_INDEX);
-schemaName = resultSet.getString(SCHEMA_INDEX);
-catalogName = resultSet.getString(CATALOG_INDEX);
-packTable(tableName, catalogName, schemaName, null);
-}
-packFunctions(connection);
-}
-}
+processCatalogs(connection, types);
 }
 return databaseReverseEngineering;
 }
 
-public ReverseEngineering loadColumns(DBConnectionInfo connectionInfo, 
ClassLoadingService loadingService, TreePath path) throws SQLException {
-String catalogName = path.getPathComponent(1).toString();
-String schemaName = null;
+private void 

[cayenne] branch STABLE-4.1 updated: CAY-2600 Modeler DbImport: Can't retrieve schema for databases with no catalog support

2019-08-15 Thread abulatski
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch STABLE-4.1
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/STABLE-4.1 by this push:
 new fc52cf2  CAY-2600 Modeler DbImport: Can't retrieve schema for 
databases with no catalog support
fc52cf2 is described below

commit fc52cf219e9fb01f8e72e7bd9e0467af24c2a3b0
Author: Arseni Bulatski 
AuthorDate: Thu Aug 15 14:05:42 2019 +0300

CAY-2600 Modeler DbImport: Can't retrieve schema for databases with no 
catalog support

(cherry picked from commit 285d75237d8b0659771c2f219562b57397f19f02)
---
 RELEASE-NOTES.txt  |   1 +
 .../editor/dbimport/DatabaseSchemaLoader.java  | 179 -
 .../modeler/editor/dbimport/DbImportTree.java  |  48 --
 3 files changed, 138 insertions(+), 90 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 4a5c865..953bc62 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -30,6 +30,7 @@ CAY-2591 Modeler: project becomes dirty after click on 
dbImport or cgen tab
 CAY-2594 DbImport: AutoAdapter resolving inside an import operation hangs up 
the op on Hana DB
 CAY-2595 ObjAttributes are not sorted in alphabetical ordering on save
 CAY-2596 DbImport xml config changes after dbImport plugin task execution
+CAY-2600 Modeler DbImport: Can't retrieve schema for databases with no catalog 
support
 CAY-2601 Modeler DbImport: result dialog issues
 CAY-2603 NPE reloading project in the model
 CAY-2605 Modeler: Unable to save - java.nio.file.InvalidPathException
diff --git 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/DatabaseSchemaLoader.java
 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/DatabaseSchemaLoader.java
index 30403a4..720541c 100644
--- 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/DatabaseSchemaLoader.java
+++ 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/DatabaseSchemaLoader.java
@@ -26,18 +26,19 @@ import java.sql.SQLException;
 import java.util.Collection;
 
 import org.apache.cayenne.dbsync.reverse.dbimport.Catalog;
+import org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer;
 import org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn;
 import org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure;
 import org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable;
 import org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering;
 import org.apache.cayenne.dbsync.reverse.dbimport.Schema;
 import org.apache.cayenne.modeler.ClassLoadingService;
+import org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode;
 import org.apache.cayenne.modeler.pref.DBConnectionInfo;
 
 public class DatabaseSchemaLoader {
 
 private static final String INCLUDE_ALL_PATTERN = "%";
-private static final String EMPTY_DEFAULT_CATALOG = "";
 private static final int TABLE_INDEX = 3;
 private static final int SCHEMA_INDEX = 2;
 private static final int CATALOG_INDEX = 1;
@@ -56,36 +57,82 @@ public class DatabaseSchemaLoader {
 tableTypesFromConfig :
 new String[]{"TABLE", "VIEW", "SYSTEM TABLE",
 "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", 
"SYNONYM"};
-try (ResultSet rs = connection.getMetaData().getCatalogs()) {
-String defaultCatalog = connection.getCatalog();
-while (rs.next()) {
-ResultSet resultSet;
-if (defaultCatalog.equals(EMPTY_DEFAULT_CATALOG)) {
-resultSet = connection.getMetaData()
-.getTables(rs.getString(1), null, 
INCLUDE_ALL_PATTERN, types);
-} else {
-resultSet = connection.getMetaData()
-.getTables(defaultCatalog, null, 
INCLUDE_ALL_PATTERN, types);
-}
-String tableName = "";
-String schemaName = "";
-String catalogName = "";
-while (resultSet.next()) {
-tableName = resultSet.getString(TABLE_INDEX);
-schemaName = resultSet.getString(SCHEMA_INDEX);
-catalogName = resultSet.getString(CATALOG_INDEX);
-packTable(tableName, catalogName, schemaName, null);
-}
-packFunctions(connection);
-}
-}
+processCatalogs(connection, types);
 }
 return databaseReverseEngineering;
 }
 
-public ReverseEngineering loadColumns(DBConnectionInfo connectionInfo, 
ClassLoadingService loadingService, TreePath path) throws SQLException {
-String catalogName =