3 Replies Latest reply on Aug 29, 2005 10:04 PM by jsoltero

    Problem with Postgresql boolen type with Jboss

    ramarao_1234

      Dear all,
      When i am using boolen value in EJB postgres is giving an eroor.field is of type boolen but expression is of type char.

      Anybody who have got this type of error plz help me.

      Thanks.

      Ramarao.

        • 1. Re: Problem with Postgresql boolen type with Jboss

          You're probably using postgres 8.0, aren't you?

          The default PostgreSQL mapping in the standardjbosscmp-jdbc.xml does not apply for postgres 8.0
          Change the following fragment in the type-mapping for PostgreSQL

          <java-type>java.lang.Boolean</java-type>
          <jdbc-type>CHAR</jdbc-type>
          <sql-type>BOOLEAN</sql-type>

          into

          <java-type>java.lang.Boolean</java-type>
          <jdbc-type>BOOLEAN</jdbc-type>
          <sql-type>BOOLEAN</sql-type>


          Cheers,
          Peter

          • 2. Re: Problem with Postgresql boolen type with Jboss
            crmwind

            I had the same error as Ramarao (also using Postgres 8.0). I tried the suggestion by Peter, but still the same message (which I repeat below without typos)

            java.sql.SQLException: ERROR: column "xyz" is of type boolean but expression is of type character

            After experimenting, I got it to work by changing the type of my boolean fields in the ddl to varchar (probably can be char(5)).

            I hope someone else can clarify this or come up with a better solution.

            • 3. Re: Problem with Postgresql boolen type with Jboss
              jsoltero

              This post is pretty old, but in case someone else runs into this...

              append
              ?protocolVersion=2

              to your jdbc connect string defined in your datasource. this is problem springs from the new 8.0.x JDBC driver, it didnt happen to us with the 7.4 JDBC driver