hi javier,

On 11/3/05, Javier Bermejo <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Some days ago I was testing performance using orm-persistence with
> hibernate 2 and PostgreSQL. Today I have tested SimpleDBPersistence
> using a postgreSQL database and I have detected a bug in the class:
>
> Using JDBC with PostgreSQL doesn't found any table when checking the
> schema because it needs the tableNamePattern in lowercase (not
> uppercase), the effect is that it tries to create every time you start
> the repository the tables and get a Exception. So the solution I propose
> is to search the tableNamePattern using lower and uppercase in the
> checkSchema method:
>
>     protected void checkSchema() throws Exception {
>         String tableName = schemaObjectPrefix + "NODE";
>         ResultSet rs1 = con.getMetaData().getTables(null, null,
>                 (tableName).toLowerCase(), null);
>         ResultSet rs2 = con.getMetaData().getTables(null, null,
>                 tableName, null);
>         boolean schemaExists;
>         try {
>             schemaExists = rs1.next() || rs2.next();
>         } finally {
>             rs1.close();
>             rs2.close();
>         }
>
> I attach the diff from latest version in svn.

thanks! i  will have a look at it asap.

btw: i'd be very interested in the results of your performance tests.
could you please share them with us?

btw2: it would be cool if you could contribute a postgres.ddl file
that works with SimpleDbPersistenceManager  (see o.a.j.c.state.db.mysql.ddl
for an an example for mysql). i 'd more than happy to commit it :)

cheers
stefan

>
> Best regards
>   Javier Bermejo
>
>
>
> Index: 
> src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
> ===================================================================
> --- 
> src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
>    (revisión: 330576)
> +++ 
> src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
>    (copia de trabajo)
> @@ -924,13 +924,17 @@
>       * @throws Exception if an error occurs
>       */
>      protected void checkSchema() throws Exception {
> -        ResultSet rs = con.getMetaData().getTables(null, null,
> -                schemaObjectPrefix + "NODE", null);
> +       String tableName = schemaObjectPrefix + "NODE";
> +               ResultSet rs1 = con.getMetaData().getTables(null, null,
> +                (tableName).toLowerCase(), null);
> +        ResultSet rs2 = con.getMetaData().getTables(null, null,
> +                tableName, null);
>          boolean schemaExists;
>          try {
> -            schemaExists = rs.next();
> +            schemaExists = rs1.next() || rs2.next();
>          } finally {
> -            rs.close();
> +            rs1.close();
> +            rs2.close();
>          }
>
>          if (!schemaExists) {
>
>
>

Reply via email to