Re: [PATCH] NPE in meta data getPrimaryKeys()

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: Anders Hermansen <anders(at)yoyo(dot)no>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [PATCH] NPE in meta data getPrimaryKeys()
Date: 2002-12-17 16:43:56
Message-ID: 1040143436.14875.258.camel@inspiron.cramers
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Anders,

Where in the jdbc interface does it say that getTables takes 3 null
parameters?

Dave
On Tue, 2002-12-17 at 11:35, Anders Hermansen wrote:
> Hello,
>
> I'm trying to use jakarta ojb for database access in a web application.
> For this I have to generate a object-relational mapping. There is a
> tool, reversedb, that will generate this for a live database.
>
> When I run this against my postgresql database I get the following
> exception:
>
> java.lang.NullPointerException
> at
> org.postgresql.jdbc1.AbstractJdbc1DatabaseMetaData.escapeQuotes(AbstractJdbc1DatabaseMetaData.java:1666)
> at
> org.postgresql.jdbc1.AbstractJdbc1DatabaseMetaData.getPrimaryKeys(AbstractJdbc1DatabaseMetaData.java:2899)
> at
> org.apache.ojb.tools.mapping.reversedb.DBMeta.read(Unknown Source)
> at
> org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame.analyzeSchema(Unknown
> Source)
> (...)
>
> It fails with a npe because table was set to null. Is setting table to
> null for the getPrimaryKeys illegall according to jdbc specification?
>
> As it seems ojb is requesting primary keys for all tables when table is
> set to null, and is assuming this will be legal
>
> >From line 279 i in DBMeta.read() in ojb source:
> rs = this.dbMeta.getPrimaryKeys(null, null, null);
>
> Attached is a patch which makes the getPrimaryKeys method accept the
> value of null for the table parameter.
>
> Is this the correct solution?
>
>
> Anders
>
> --
> Anders Hermansen
> YoYo Mobile as
>
> ______________________________________________________________________
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--
Dave Cramer <Dave(at)micro-automation(dot)net>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Daniel Serodio 2002-12-17 16:44:16 Re: [PATCH] NPE in meta data getPrimaryKeys()
Previous Message Anders Hermansen 2002-12-17 16:35:16 [PATCH] NPE in meta data getPrimaryKeys()