0 Replies Latest reply on Nov 9, 2006 1:04 PM by Antoine Herzog

    DB2 / Hibernate mapping / error at starting

    Antoine Herzog Master

      JBoss Portal 2.4
      DB2 8

      When the portal starts, there are some errors with some types used in portal, that don't fit with hibernate + DB2.
      Error : "ERROR [org.hibernate.util.JDBCExceptionReporter] DB2 SQL error: SQLCODE: -204,..."
      Error 204 is : "The object identified by _name_ is not found in the database".

      Some tables cannot be created, because the fields mapping is not correct.
      A string type (default type) with length 50000000 cannot be created in DB2, hence the whole table is not created.

      In jboss-portal.sar\conf\hibernate_db2\instance\domain.hbm.xml
      In table="JBP_INSTANCE", change

      <property
       name="state"
       column="SER_STATE"
       not-null="false"
       unique="false"
       length="50000000"/>

      with
      <property
       name="state"
       column="SER_STATE"
       not-null="false"
       unique="false"
       type="text"
       />

      And in table="JBP_INSTANCE_PER_USER", change
      <property
       name="state"
       column="SER_STATE"
       not-null="false"
       unique="false"
       length="50000000"/>

      with
      <property
       name="state"
       column="SER_STATE"
       not-null="false"
       unique="false"
       type="text"/>


      Put type="text" instead of length="50000000" (and default type="string").