mySQL error with CMP2.0/JBOSS 3.0
jeffreychang Dec 18, 2001 12:04 AM
I've checked out JBOSS 3.0 CVS (snapshot of 12/16), compiled and run it using mySQL as datasource without error. But when my CMP20 Entity Bean test code is deployed, the following error was observed in server.log:
2001-12-17 20:36:41,229 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Parent] Executing SQL: CREATE TABLE Parent (parentId INTEGER, parentName VARCHAR(255) BINARY, CONSTRAINT pkParent PRIMARY KEY (parentId))
2001-12-17 20:36:41,349 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Parent] Could not create table Parent
java.sql.SQLException: General error: All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead
at org.gjt.mm.mysql.MysqlIO.sendCommand(MysqlIO.java:497)
at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(MysqlIO.java:550)
at org.gjt.mm.mysql.MysqlIO.sqlQuery(MysqlIO.java:635)
at org.gjt.mm.mysql.Connection.execSQL(Connection.java:882)
at org.gjt.mm.mysql.Connection.execSQL(Connection.java:815)
at org.gjt.mm.mysql.Statement.executeUpdate(Statement.java:227)
at org.gjt.mm.mysql.jdbc2.Statement.executeUpdate(Statement.java:97)
at org.jboss.resource.adapter.jdbc.local.StatementInPool.executeUpdate(StatementInPool.java:736)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:133)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:63)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:231)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:174)
at org.jboss.ejb.EntityContainer.start(EntityContainer.java:335)
at org.jboss.ejb.Application.start(Application.java:219)
at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:376)
at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:300)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:463)
at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:435)
at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:202)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.deployment.AutoDeployer.deploy(AutoDeployer.java:683)
at org.jboss.deployment.AutoDeployer.run(AutoDeployer.java:326)
at java.lang.Thread.run(Thread.java:484)
It looks like mySQL is not happy about the primary key field without "NOT NULL" or "DEFAULT" keyword. The same test code was running fine a while ago. Any clue?