1 Reply Latest reply on Mar 10, 2003 1:17 PM by greg

    SQLException with postgres when deploying

    greg Newbie

      Hi,
      When I try to deploy my beans using postgresql as datasource, I get the following exception:
      16:34:41,243 WARN [ServiceController] Problem starting service jboss.j2ee:jndiN
      ame=ejb/MyBeanLocalHome,service=EJB
      org.jboss.deployment.DeploymentException: Error while creating table; - nested t
      hrowable: (java.sql.SQLException: ERROR: parser: parse error at or near "." at
      character 108
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStart
      Command.java:175)

      When looking in the logs of my postgres, I see jboss is trying to run the following query:
      CREATE TABLE public.mytable (mytable_id INT4 NOT NULL, description TEXT, CONSTRAINT pk_public.mytable PRIMARY KEY (mytable_id))

      If I run this query manually, it gives the same syntax error message. If I try it like this (without the pk_public.)
      CREATE TABLE public.mytable (mytable_id INT4 NOT NULL, description TEXT, CONSTRAINT mytable PRIMARY KEY (mytable_id))
      it works fine. (ie it tells me the table already exists)
      I did nothing "special" to create this database, so I have "public" as default schema, and that's it, as far as I know.

      Can anyone tell me what's wrong, or where this "pk_public" is coming from? Or did i simply miss something in postgres's install???

        • 1. Re: SQLException with postgres when deploying
          greg Newbie

          the beans were generated through middlegen. Middlegen had gone
          * @ejb.persistence table-name="public.tablename"
          and that's were the problem was coming from. Removing it solved the problem (since the pk name was created after the pattern "pk_${whatever-is-in-@ejb.persistence-table-name}"

          I am not yet sure how this *should* work, since, I guess, jboss should somewhere still be aware of what schema to use when accessing postgres.. well now it's not anymore. My beans deploy correctly, haven't had the chance to test if they were actually working ;)

          If someone has any tips about tips, they're welcome!

          cheers

          greg