cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Borut Bolčina <...@najdi.si>
Subject Re: Mysql InnoDB and ForeignKeys
Date Mon, 31 Jul 2006 07:22:37 GMT
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:

Mime
View raw message