5 Replies Latest reply on Aug 29, 2002 11:40 AM by Dain Sundstrom

    MySql ,JbossCMP2.0 and NOT NULL

    far Newbie

      I created a CMP table in MySql using the <not-null/>.Checking Jboss console I made sure that Primary key is created NOT NULL but whenever I try to insert entities into my table I get this error:

      2002-08-26 05:21:41,164 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.ContactInfoEJB] Could not create entity
      java.sql.SQLException: General error: Column 'telephone' cannot be null
      Am I doing anything wrong here or is it MySQl driver problem because when I do this in mysql console I don't get this kind of error ....or is is JBossCMP implemenation problem ..? G
      thank u for any suggestion
      Faisal UK

        • 1. Re: MySql ,JbossCMP2.0 and NOT NULL
          Tung Dang Novice

          Is the field telephone the primary key of the table? If not, you should set it null in the database because except the primary key Jboss does not allow other keys not null.

          Hope it helps.

          • 2. Re: MySql ,JbossCMP2.0 and NOT NULL
            far Newbie

            Thanks for the reply
            This is the rest of the error I am getting :

            ***** I changed th primary key to familyName ***********


            Executing SQL: SELECT COUNT(*) FROM contactinfoejb WHERE familyName=?
            2002-08-26 17:39:10,315 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.ContactInfoEJB] Executing SQL: INSERT INTO contactinfoejb (familyName, telephone, email, givenName, poIdd, PO_ID, status) VALUES (?, ?, ?, ?, ?, ?, ?)
            2002-08-26 17:39:10,335 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.ContactInfoEJB] Could not create entity
            java.sql.SQLException: General error: Column 'familyName' cannot be null
            at org.gjt.mm.mysql.MysqlIO.sendCommand(Unknown Source)
            at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(Unknown Source)
            at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)
            at org.gjt.mm.mysql.PreparedStatement.executeUpdate(Unknown Source)
            at org.gjt.mm.mysql.PreparedStatement.executeUpdate(Unknown Source)

            any clue !
            thanks

            • 3. Re: MySql ,JbossCMP2.0 and NOT NULL
              far Newbie

              It was mysql own pb I'll never use mysql with CMP beans
              thanks
              Faisal

              • 4. Re: MySql ,JbossCMP2.0 and NOT NULL
                far Newbie

                Well it wasn't MySql -it seems to be a serious bug in jboss
                Faisal

                • 5. Re: MySql ,JbossCMP2.0 and NOT NULL
                  Dain Sundstrom Master

                  I doubt this is a bug, because if it were no application would run on JBoss.

                  What is the Java type and SQL type of the telephone or faimlyName field?

                  Are you creating the table by hand or allowing JBoss to do it for you?

                  Did you set a value for telephone or familyName? If they are declared not null and are not primitives you must set a value.

                  What is the primary key field and type? Are you using a custom pk class?