cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Mysql InnoDB and ForeignKeys
Date Mon, 31 Jul 2006 13:25:17 GMT
Borut is correct - the current default policy was implemented with  
MyISAM tables in mind (that do not support FK constraints). We should  
probably change the default to allow constraints, as the user always  
has a choice to disable them in the generator.

For now you may use any of the MySQL tools to create constraints by  
hand. I use phpMyAdmin.

Andrus


On Jul 31, 2006, at 3:22 AM, Borut Bolčina wrote:

> 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-logo.gif>
>
> --
> Naključna izjava tedna iz tednika Mladina:


Mime
View raw message