jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Javier Bermejo <jberm...@germinus.com>
Subject SimpleDBPersistenceManager and PostgreSQL
Date Thu, 03 Nov 2005 17:17:36 GMT

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 {

I attach the diff from latest version in svn.

Best regards
  Javier Bermejo

View raw message