2 Replies Latest reply on Oct 30, 2003 3:30 PM by sysuser1

    Unable to Insert

    sysuser1

      Hello

      I tried to insert a record and I get the following error. Is there a way I can see the actual SQL query that is generated.

      INFO [STDOUT] Creating a New user dbif.dto.SystemUser: userID='null', userName='admin', userPassword='JLnIDDRXmvIYY/dqe0W2yA==', userRealName='Administrator'
      DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.SystemUserEntity] Create: pk=null
      DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.SystemUserEntity] Executing SQL: SELECT COUNT(*) FROM SYSTEM_USER WHERE userID=?
      DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.SystemUserEntity] [SystemUserEntity.ejbCreate] Executing SQL: INSERT INTO SYSTEM_USER (userID, userName, userPassword, userRealName) VALUES (?, ?, ?, ?)
      [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.SystemUserEntity] Could not create entity
      java.sql.SQLException: General error, message from server: "Column 'userName' cannot be null"
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
      at com.mysql.jdbc.Connection.execSQL(Connection.java:2030)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1750)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1596)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:308)


      Any help is appreciated. I am using JBoss 3.2.1

      Thanks
      VM

        • 1. Re: Unable to Insert
          schmidts

          See conf/log4j.xml about how to enable additional traceing of parameters to a prepared statement.





          Try setting "not null" attributes in ejbCreate().

          • 2. Re: Unable to Insert
            sysuser1

            Thanks!! That was easy. But I am still trying to find why my userName is set to null. But I can dig more within my project. But your suggestion will help to keep an eye on the SQL statements.

            Thanks again

            VM