Re: Mysql InnoDB and ForeignKeys

From: Borut Bolčin (bo..ajdi.si)
Date: Mon Jul 31 2006 - 03:22:37 EDT

  • Next message: Andrus Adamchik: "Re: Mysql InnoDB and ForeignKeys"

    If you use MySQL...

    Modeler does not support MySQL FK statements (ADD FOREIGN KEY (foo_fk)
    REFERENCES foo (oid))
    You have to generate database tables through API with
    generator.runGenerator(dataSource)

    You have to to use
                MySQLAdapter mysqlDbAdapter = new MySQLAdapter(); and not
    AutoAdapter
    then
                mysqlDbAdapter.setSupportsFkConstraints(true);
                generator = new DbGenerator(mysqlDbAdapter, dataMap);
               
                generator.setShouldCreatePKSupport(true);
                generator.setShouldCreateFKConstraints(true);
                generator.setShouldDropTables(false);
    then

            try {
                generator.runGenerator(dataSource);
             } catch (Exception e) {
                logger.error("Error running database generator for " +
    dataMap.getName(), e);
             }

    I hope this will get you started,
    Borut

    On 31.7.2006 0:04, raggeler wrote:
    > Hi all
    >
    > I just created a database schema with DBDesigner, created a database
    > with it, used InnoDB and Foreigkeys there. I re engineered the
    > database in the modeler, and created an SQL Create Script again. I
    > checked FK support, used Automatic is adapter, but can't find any
    > "FOREIGNKEY" option in the create script?...
    > Are there some more options I must turn on or off?
    >
    > Regards
    >
    > Rafael

    -- 
    bLOG <http://www.delo.si/blog/borutb/>
    --
    Naključna *izjava tedna* iz tednika Mladina:
    



    This archive was generated by hypermail 2.0.0 : Mon Jul 31 2006 - 03:23:34 EDT