MySql auto generated PK

From: Borut Bolčin (bo..ajdi.si)
Date: Wed Jun 21 2006 - 02:52:44 EDT

  • Next message: Gentry, Michael \(Contractor\): "RE: Generating primary key locally without extra tables"

    Is something broken or am I missing something in my setup, but when
    inserting, Cayenne is generating PK instead of using AUTO_PK_SUPPORT.

    I use Cayenne 1.2RC1, mysql-connector-java-3.1.13
    This is mapping:
    <db-attribute name="oid" type="INTEGER" isPrimaryKey="true"
    isGenerated="true" isMandatory="true"/>

    and this is how I generate the tables
    MySQLAdapter mysqlDbAdapter = new MySQLAdapter();
    mysqlDbAdapter.setSupportsFkConstraints(true);
    mysqlDbAdapter.setSupportsGeneratedKeys(true);
    generator = new DbGenerator(mysqlDbAdapter, dataMap);
    generator.setShouldCreatePKSupport(true);
    generator.setShouldCreateFKConstraints(true);
    generator.setShouldDropTables(false);
    generator.runGenerator(dataSource);

    AUTO_PK_SUPPORT table gets generated and correctly populated with table
    names and initial value 200.

    When inserting records, Cayenne inserts records with PK 1,2,3,...
    ignoring AUTO_PK_SUPPORT. No SELECT FROM AUTO_PK_SUPPORT happens in log
    files.

    What did I miss. I think this worked months ago when exercising Cayenne
    with some simple examples.

    Cheers,
    Borut



    This archive was generated by hypermail 2.0.0 : Wed Jun 21 2006 - 02:53:10 EDT