4 Replies Latest reply on Apr 19, 2002 5:12 AM by jcraig

    Blob - Problem deploying using JBoss 3 CR1 and Mysql

    jcraig

      Hi everyone

      I downloaded JBoss 3 CR1 and am trying to get it to work with MySQL. I think my login-config.xml and mysql-service.xml files are set up correctly. When I deploy my application the following exception/s are thrown.



      13:16:50,296 INFO [EjbModule] Creating
      13:16:50,326 INFO [EjbModule] Deploying Title
      13:16:52,940 INFO [EjbModule] Created
      13:16:52,950 INFO [EjbModule] Starting
      13:16:53,040 ERROR [EntityContainer] Exception in service lifecyle operation: st
      art
      org.jboss.deployment.DeploymentException: Error while creating table; - nested t
      hrowable is: java.sql.SQLException: General error: BLOB column 'titleID' used in
      key specification without a key length
      java.sql.SQLException: General error: BLOB column 'titleID' used in key specific
      ation without a key length
      at org.gjt.mm.mysql.MysqlIO.sendCommand(Unknown Source)
      at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(Unknown Source)
      at org.gjt.mm.mysql.MysqlIO.sqlQuery(Unknown Source)
      at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)
      at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)
      at org.gjt.mm.mysql.Statement.executeUpdate(Unknown Source)
      at org.gjt.mm.mysql.jdbc2.Statement.executeUpdate(Unknown Source)
      at org.jboss.resource.adapter.jdbc.local.StatementInPool.executeUpdate(S
      tatementInPool.java:736)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStart
      Command.java:169)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartComm
      and.java:84)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
      r.java:384)



      Does anybody know what could be wrong?

      Thanks

        • 1. Re: Blob - Problem deploying using JBoss 3 CR1 and Mysql
          davidjencks

          IMO you are correct that the db config is correct. It looks like the titleID is getting mapped to a BLOB column. Maybe it is seen as a plain java object that is getting serialized???

          • 2. Re: Blob - Problem deploying using JBoss 3 CR1 and Mysql
            jcraig

            Hi... Thanks for the quick response! My primary key is a serializable java object. (Doesn't seem to be many examples/people which use this approach). It always works when I use the hypersonic db. The primary key object get stored as a blob. It also used to work when I used MySQL with CMP1. Are there any problems with having 'custom' objects as your primary key class when using MySQL etc? It I convert the primary to use an Integer for example everything works fine.
            I have included an extract of my ejb-jar file below. Maybe it will help...


            <ejb-name>Title</ejb-name>
            <local-home>za.co.connectivit.ptisan.misc.TitleLocalHome</local-home>
            za.co.connectivit.ptisan.misc.TitleLocal
            <ejb-class>za.co.connectivit.ptisan.misc.TitleBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>za.co.connectivit.ptisan.misc.TitleID</prim-key-class>
            False
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>TitleBean</abstract-schema-name>
            <cmp-field>
            <field-name>titleID</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>name</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>description</field-name>
            </cmp-field>
            <primkey-field>titleID</primkey-field>
            <resource-ref>
            <res-ref-name>jdbc/mySQLDS</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>

            • 3. Re: Blob - Problem deploying using JBoss 3 CR1 and Mysql
              dsundstrom

              Most databases won't let you use a blob as a primary key, because you can't index a blob.

              • 4. Re: Blob - Problem deploying using JBoss 3 CR1 and Mysql
                jcraig

                By the look of things MySQL does allow a primary key data type to be larger 255. After careful consideration I have decided to change my approach with regard to using 'custom' java objects as primary keys. I am going to go the unique OID route. I don't want to have to limit my choice in databases because to primary key/indexing restrictions.

                Thanks for all the help.