2 Replies Latest reply on Jan 1, 2003 1:27 PM by janb

    existing tables don't, actually

    eggboy

      i am using cmp 2.0 with jboss 3.2 beta and postgresql 7.2.2 and am noting some odd behavior. i have the cmp set up to create and drop all the tables on it's own, using postgresql for the datastore.

      when jboss starts up, it creates one of the tables just fine, but it decides that all the other ones exist already. they don't. when it shuts down it removes that one table too, so i know it is using the correct backend.

      from the logs i see something like:

      2002-12-23 07:08:51,820 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.SubjectBean] Created table 'subject' successfully.

      but a few lines later:

      2002-12-23 07:08:51,900 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.PaintingBean] Table 'painting' already exists
      2002-12-23 07:08:51,919 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.PaintingBean] Table 'painting_subject' already exists

      and when it's up and running there is only the subject table in existence.

      can anyone provide any suggestions or help? i don't know how to dig into this to see what jboss is doing that makes it think the tables that don't exist do.

      thanks to all.
      john

        • 1. Re: existing tables don't, actually
          lorensrosen

          One thing you could do is get postgres to log the
          queries it receives, and see if JBoss is indeed
          checking the existence of the other tables. (Start
          postmaster with the -d 2 flag.)

          • 2. Re: existing tables don't, actually
            janb

            This is a problem in the Postgres JDBC driver implementation of DatabaseMetaData getTables() method which the JBoss CMP implementation uses to determine whether the tables already exist or not. There is a postgres patch for this to make it work correctly under 7.2.x, however the pre-built driver jars don't seem to include this patch. The only alternative seems to be to download the Postgres source and compile the driver jar.

            Here is a reference to the patch: http://fts.postgresql.org/db/mw/msg.html?mid=1361097

            If you find another work around, or a pre-built jar somewhere, I'd appreciate hearing about it.

            regards,
            Jan