You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Schönfisch, Jörg <jo...@softplant.de> on 2011/12/23 09:45:47 UTC

ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

Hi everybody,

I'm using a ThrowOnPartialOrCreateSchemaStrategy and I ran into the problem that my tables are not generated if I specify a schema for the DbEntities. SchemaAnalyzer.compareTables only checks if the schema exists and doesn't verify if it actually contains any tables. I'm using the latest trunk (rev 1222604) and Postgres 8.3. The following patch fixes the problem for me. Should I raise an issue in JIRA for this?

Cheers,
Joerg



Index: SchemaAnalyzer.java
===================================================================
--- SchemaAnalyzer.java	(revision 1222604)
+++ SchemaAnalyzer.java	(working copy)
@@ -119,7 +119,12 @@
 
             if (schema != null) {
                 if (schemaNameMap.get(schema) != null) {
-
+                    Collection<String> names = schemaNameMap.get(schema);
+                    if (names.contains(name)) {
+                        mapTableInDB.put(name, schema);
+                    } else {
+                        tableNoInDB.add(name);
+                    }
                 }
                 else {
                     isIncluded = false;

AW: AW: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

Posted by Schönfisch, Jörg <jo...@softplant.de>.
Hi Andrus,

Issues is created as CAY-1650. I'm glad to be of any help, Cayenne is a great framework :)

Cheers,
Joerg


-----Ursprüngliche Nachricht-----
Von: Andrus Adamchik [mailto:andrus@objectstyle.org] 
Gesendet: Montag, 9. Januar 2012 09:48
An: dev@cayenne.apache.org
Betreff: Re: AW: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

Hi Joerg,

sorry for delayed reply. Your analysis seems valid. Yes, please open a Jira with your patch. CAY-1226 is probably a different limitation. 

Thanks,
Andrus


On Jan 9, 2012, at 10:38 AM, Schönfisch, Jörg wrote:
> Any feedback on this?
> 
> Regards
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Schönfisch, Jörg [mailto:joerg.schoenfisch@softplant.de] 
> Gesendet: Freitag, 23. Dezember 2011 09:50
> An: dev@cayenne.apache.org
> Betreff: AW: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables
> 
> CAY-1226 might also be related to this.
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Schönfisch, Jörg [mailto:joerg.schoenfisch@softplant.de] 
> Gesendet: Freitag, 23. Dezember 2011 09:46
> An: dev@cayenne.apache.org
> Betreff: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables
> 
> Hi everybody,
> 
> I'm using a ThrowOnPartialOrCreateSchemaStrategy and I ran into the problem that my tables are not generated if I specify a schema for the DbEntities. SchemaAnalyzer.compareTables only checks if the schema exists and doesn't verify if it actually contains any tables. I'm using the latest trunk (rev 1222604) and Postgres 8.3. The following patch fixes the problem for me. Should I raise an issue in JIRA for this?
> 
> Cheers,
> Joerg
> 
> 
> 
> Index: SchemaAnalyzer.java
> ===================================================================
> --- SchemaAnalyzer.java	(revision 1222604)
> +++ SchemaAnalyzer.java	(working copy)
> @@ -119,7 +119,12 @@
> 
>             if (schema != null) {
>                 if (schemaNameMap.get(schema) != null) {
> -
> +                    Collection<String> names = schemaNameMap.get(schema);
> +                    if (names.contains(name)) {
> +                        mapTableInDB.put(name, schema);
> +                    } else {
> +                        tableNoInDB.add(name);
> +                    }
>                 }
>                 else {
>                     isIncluded = false;
> 


Re: AW: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Joerg,

sorry for delayed reply. Your analysis seems valid. Yes, please open a Jira with your patch. CAY-1226 is probably a different limitation. 

Thanks,
Andrus


On Jan 9, 2012, at 10:38 AM, Schönfisch, Jörg wrote:
> Any feedback on this?
> 
> Regards
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Schönfisch, Jörg [mailto:joerg.schoenfisch@softplant.de] 
> Gesendet: Freitag, 23. Dezember 2011 09:50
> An: dev@cayenne.apache.org
> Betreff: AW: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables
> 
> CAY-1226 might also be related to this.
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Schönfisch, Jörg [mailto:joerg.schoenfisch@softplant.de] 
> Gesendet: Freitag, 23. Dezember 2011 09:46
> An: dev@cayenne.apache.org
> Betreff: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables
> 
> Hi everybody,
> 
> I'm using a ThrowOnPartialOrCreateSchemaStrategy and I ran into the problem that my tables are not generated if I specify a schema for the DbEntities. SchemaAnalyzer.compareTables only checks if the schema exists and doesn't verify if it actually contains any tables. I'm using the latest trunk (rev 1222604) and Postgres 8.3. The following patch fixes the problem for me. Should I raise an issue in JIRA for this?
> 
> Cheers,
> Joerg
> 
> 
> 
> Index: SchemaAnalyzer.java
> ===================================================================
> --- SchemaAnalyzer.java	(revision 1222604)
> +++ SchemaAnalyzer.java	(working copy)
> @@ -119,7 +119,12 @@
> 
>             if (schema != null) {
>                 if (schemaNameMap.get(schema) != null) {
> -
> +                    Collection<String> names = schemaNameMap.get(schema);
> +                    if (names.contains(name)) {
> +                        mapTableInDB.put(name, schema);
> +                    } else {
> +                        tableNoInDB.add(name);
> +                    }
>                 }
>                 else {
>                     isIncluded = false;
> 


AW: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

Posted by Schönfisch, Jörg <jo...@softplant.de>.
Any feedback on this?

Regards


-----Ursprüngliche Nachricht-----
Von: Schönfisch, Jörg [mailto:joerg.schoenfisch@softplant.de] 
Gesendet: Freitag, 23. Dezember 2011 09:50
An: dev@cayenne.apache.org
Betreff: AW: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

CAY-1226 might also be related to this.


-----Ursprüngliche Nachricht-----
Von: Schönfisch, Jörg [mailto:joerg.schoenfisch@softplant.de] 
Gesendet: Freitag, 23. Dezember 2011 09:46
An: dev@cayenne.apache.org
Betreff: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

Hi everybody,

I'm using a ThrowOnPartialOrCreateSchemaStrategy and I ran into the problem that my tables are not generated if I specify a schema for the DbEntities. SchemaAnalyzer.compareTables only checks if the schema exists and doesn't verify if it actually contains any tables. I'm using the latest trunk (rev 1222604) and Postgres 8.3. The following patch fixes the problem for me. Should I raise an issue in JIRA for this?

Cheers,
Joerg



Index: SchemaAnalyzer.java
===================================================================
--- SchemaAnalyzer.java	(revision 1222604)
+++ SchemaAnalyzer.java	(working copy)
@@ -119,7 +119,12 @@
 
             if (schema != null) {
                 if (schemaNameMap.get(schema) != null) {
-
+                    Collection<String> names = schemaNameMap.get(schema);
+                    if (names.contains(name)) {
+                        mapTableInDB.put(name, schema);
+                    } else {
+                        tableNoInDB.add(name);
+                    }
                 }
                 else {
                     isIncluded = false;

AW: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

Posted by Schönfisch, Jörg <jo...@softplant.de>.
CAY-1226 might also be related to this.


-----Ursprüngliche Nachricht-----
Von: Schönfisch, Jörg [mailto:joerg.schoenfisch@softplant.de] 
Gesendet: Freitag, 23. Dezember 2011 09:46
An: dev@cayenne.apache.org
Betreff: ThrowOnPartialOrCreateSchemaStrategy, DbEntities with schema, and missing tables

Hi everybody,

I'm using a ThrowOnPartialOrCreateSchemaStrategy and I ran into the problem that my tables are not generated if I specify a schema for the DbEntities. SchemaAnalyzer.compareTables only checks if the schema exists and doesn't verify if it actually contains any tables. I'm using the latest trunk (rev 1222604) and Postgres 8.3. The following patch fixes the problem for me. Should I raise an issue in JIRA for this?

Cheers,
Joerg



Index: SchemaAnalyzer.java
===================================================================
--- SchemaAnalyzer.java	(revision 1222604)
+++ SchemaAnalyzer.java	(working copy)
@@ -119,7 +119,12 @@
 
             if (schema != null) {
                 if (schemaNameMap.get(schema) != null) {
-
+                    Collection<String> names = schemaNameMap.get(schema);
+                    if (names.contains(name)) {
+                        mapTableInDB.put(name, schema);
+                    } else {
+                        tableNoInDB.add(name);
+                    }
                 }
                 else {
                     isIncluded = false;