What version of MySQL are you using? I have 4.0.24 on Mac OS X and
this statement works just fine.
I found an indication on google that it can be a problem with some
versions of MySQL (so the statement needs to contain
"'type=myisam'"). Autoincrements are a new feature in Cayenne and
hasn't been tested across the board.
I guess if you could open a bug report (http://objectstyle.org/
cayenne/bugs-features.html) with your MySQL version, so that I can
try to reproduce it. In your own checkout copy you can fix it by
overriding "createTable" in the MySQLAdapter to generate syntax like
this:
CREATE TABLE my_table (
...
) type=myisam;
Andrus
On Aug 29, 2005, at 1:32 PM, Gili wrote:
> INFO QueryLogger: CREATE TABLE GENERATED_COLUMN_COMP_KEY (AUTO_PK
> INT NOT NULL, GENERATED_COLUMN INT NOT NULL AUTO_INCREMENT, NAME
> VARCHAR(100) NULL, PROPAGATED_PK INT NOT NULL, PRIMARY KEY
> (AUTO_PK, GENERATED_COLUMN, PROPAGATED_PK))
> ERROR CayenneTestResources: Error generating schema...
> java.sql.SQLException: Incorrect table definition; there can be
> only one auto column and it must be defined as a key
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851)
> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:2379)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:2306)
> at com.mysql.jdbc.Statement.execute(Statement.java:911)
> at org.objectstyle.cayenne.unit.AbstractAccessStack.createSchema
> (AbstractAccessStack.java:299)
> at org.objectstyle.cayenne.unit.SimpleAccessStack.createSchema
> (SimpleAccessStack.java:149)
>
This archive was generated by hypermail 2.0.0 : Mon Aug 29 2005 - 14:34:40 EDT