1 Reply Latest reply on Aug 3, 2004 6:29 PM by aalmero

    JBoss ignoring jdbc-type?

      I'm using Eclipse for JBoss development. I've configured MySQL for JBoss, and I'm able to use it for simple CMP beans where the table exists. However, when I want JBoss to create the tables, I'm having problems.

      I'm using the @ejb.persistence tag for my CMP fields, and I'm using the jdbc-type and sql-type attributes.

       /**
       * @ejb.persistence
       * column-name = "name"
       * jdbc-type="VARCHAR"
       * sql-type="varchar(64)"
       * @ejb.interface-method
       * @ejb.value-object match = "simple"
       */
       public abstract String getName();
      


      XDoclet generates the JBoss deployment descriptors, and I can see that jbosscmp-jdbc.xml file has these values:

       <cmp-field>
       <field-name>name</field-name>
       <column-name>name</column-name>
      
       <jdbc-type>CHAR</jdbc-type>
       <sql-type>varchar(64)</sql-type>
      
       </cmp-field>
      


      However, when JBoss attempts to create the table for my CMP bean, it seems to ignore these values.

      From server.log:

      --- begin log snippet ---

      Executing SQL: CREATE TABLE Workgroup (id VARCHAR(256) NOT NULL, name VARCHAR(256), CONSTRAINT pk_Workgroup PRIMARY KEY (id))

      <other JBoss stuff>

      MBeanException: org.jboss.deployment.DeploymentException: Error while creating table Workgroup; - nested throwable: (java.sql.SQLException: Invalid argument value, message from server: "Too big column length for column 'id' (max = 255). Use BLOB instead")

      --- end log snippet ---

      Is there something else I need to do to get JBoss to use the specified jdbc types?

        • 1. Re: JBoss ignoring jdbc-type?
          aalmero

          from the sql generated

          Executing SQL: CREATE TABLE Workgroup (id VARCHAR(256) NOT NULL, name VARCHAR(256), CONSTRAINT pk_Workgroup PRIMARY KEY (id))

          the error states that VARCHAR max length should only be 255.


          hth