mysql - The "cannot be added because it does not have a primary key" bug in NetBeans -
i try create entity class mysql database. wizard in netbeans give me error message "cannot added because not have primary key". got primary key in table. seems bug others have encountered in forum:
https://netbeans.org/bugzilla/show_bug.cgi?id=167389
i have tried suggestions in thread have not gotten work. missing? can force netbeans import entity class?
im using netbeans 7.3
here table:
create table if not exists `estelle`.`frasval` ( `id` int(11) not null auto_increment , `varde` varchar(45) character set 'utf8' collate 'utf8_unicode_ci' not null , `kommentar` varchar(255) character set 'utf8' collate 'utf8_unicode_ci' null , `registreratdatum` datetime not null , `frasfragasvaralternativ_id` int(11) null , `anvandare_id` int(11) not null , `patient_id` int(11) not null , `frasfraga_id` int(11) not null , primary key (`id`) , unique index `id_unique` (`id` asc) , index `fk_frasval_frasfragasvaralternativ1_idx` (`frasfragasvaralternativ_id` asc) , index `fk_frasval_anvandare1_idx` (`anvandare_id` asc) , index `fk_frasval_patient1_idx` (`patient_id` asc) , index `fk_frasval_frasfraga1_idx` (`frasfraga_id` asc) , constraint `fk_frasval_frasfragasvaralternativ1` foreign key (`frasfragasvaralternativ_id` ) references `estelle`.`frasfragasvaralternativ` (`id` ) on delete no action on update no action, constraint `fk_frasval_anvandare1` foreign key (`anvandare_id` ) references `estelle`.`anvandare` (`id` ) on delete no action on update no action, constraint `fk_frasval_patient1` foreign key (`patient_id` ) references `estelle`.`patient` (`id` ) on delete no action on update no action, constraint `fk_frasval_frasfraga1` foreign key (`frasfraga_id` ) references `estelle`.`frasfraga` (`id` ) on delete no action on update no action) engine = innodb default character set = utf8 collate = utf8_unicode_ci;
i have tried suggestions in thread have not gotten work.
are sure? code sample have posted don't show that. if necessary, update question reflect actual state of problem.
according the link provided, possible (?) workaround spell table lowercase:
"something gave me hard time funky reason table names must in lower case. if tables names in mixed case relationships not discovered during reverse engineering process. during experimentation discovered middlegen docs give warning this, guessing eclipse dali plugin uses middlegen under covers. mysql engine should innodb."
and https://netbeans.org/bugzilla/show_bug.cgi?id=167389#c11
the problem happen if have foreign keys upper case , lower case table names don't match referenced table's definition.
i suggest (1) use lowercase table names , (2) ensure table references spelled same on foreign key constraints.
create table if not exists `estelle`.`frasval` ( -- ^^^^^^^ ... references `estelle`.`frasfragasvaralternativ` (`id` ) -- ^ ^ ^ ^
you should able use underscore _
in table name (definitively make things more readable!). please post conclusions if have time made experiments!
Comments
Post a Comment