0 Replies Latest reply on Mar 13, 2003 11:11 AM by mekatoka

    Type Mapping in MySQL

    mekatoka Newbie

      Hi,

      Environment:
      -------------
      I am using JBoss 3.0.6, MySQL 3.23.55, EJB 2.0 , EMP 2.0

      Problem:
      --------
      I am having trouble doing the type-mapping for the data type java.lang.Object in standardjbosscmp-jdbc.xml.

      <java-class>java.lang.Object</java-class>
      <jdbc-type>Blob</jdbc-type>
      <sql-type>LongBlob</sql-type>

      The file by default has above mapping, but when i use that i am getting the error

      [B]org.jboss.deployment.DeploymentException: Error while creating table; - nested throwable: (java.sql.SQLException: General error, message from server: "BLOB column 'start_ip' used in key specification without a key length")[/B]

      The table which it is trying to create has a primary-key class, and the primary-key class is made of 3 columns start_ip, end_ip, subnet_mask. All 3 are of type java.net.InetAddress. The type mapping in xml doesnt have a mapping for InetAddress so, JBoss will map it to java.lang.Object.

      Solution:
      --------
      I am supposed to specify a key legnth, as per
      [U]http://www.ehrlichorg.com/02f-tech/ref-mysql.htm[/U]
      something like
      CREATE INDEX part_of_name ON customer (name(10))

      [B]But how can i specify key legnth in EJB using CMP ? [/B]

      Regards

      Meka Toka