I don't know does somebody can solve this problem but I will try...
I know how to create relationship "many-to-one" but how to create "many-to-many" relationship when you are facing myisam tables in mysql.
Here is the table structure:
CREATE TABLE `worker_zrm` ( `id_worker` int(10) unsigned NOT NULL, `id_zrm` int(10) unsigned NOT NULL, UNIQUE KEY `UNIQUE` (`id_worker`,`id_zrm`), KEY `WORKER` (`id_worker`), KEY `ZRM` (`id_zrm`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `worker` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, `kontact` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `zrm` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, `type` int(10) unsigned NOT NULL default '2', `id_station` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `id_station` (`id_station`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `order` ( `id` int(10) unsigned NOT NULL auto_increment, `pw_nr` int(10) unsigned default NULL, `zrm_id` int(10) unsigned default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
There is no foreign keys because myisam doesn't support it but I want in my generated class for `order` table to fetch all workers in zrm. Zrm is a group of workers. Table `worker_zrm` tell us which worker belong to which zrm. In table `order` we have column `zrm_id` so we want in our generated class for `order` to have such method getWorkers() with return type List<Worker>. Is there any posibility to do that with reverse enginnering tool?
|